how to change birthday plugin to display lowercase text without / separator

Status
Not open for further replies.

rw1

Moderator
/public_html/plugins/fabrik_element/birthday/birthday.php

line 265 DAY to day
line 273 MONTH to month
line 283 YEAR to year

line 307 remove /
line 309 remove /

these get overwritten with updates though.

before and after attached.
 

Attachments

  • dob1.PNG
    dob1.PNG
    2.6 KB · Views: 154
  • dob2.PNG
    dob2.PNG
    2.3 KB · Views: 154
Maybe you can use custom css that doesn't get overwritten?

Code:
div
{
text-transform:lowercase;
}

I haven't ever tried this though....
 
hmm, thanks for that idea, i did try adding that to the css and it created a situation where hovering over the element changed it to lowercase but it still loaded in caps. i started looking at language files thinking i could use text strings instead and then realised the birthday plugin does have these parameters in the backend but when entering a custom value they don't seem to be feeding through to the front end. i'm not sure if that is something to do with how the language file is set up in:

/public_html/plugins/fabrik_element/birthday/language/en-GB/en-GB.plg_fabrik_element_birthday.ini

or how it is referenced in:

/public_html/plugins/fabrik_element/birthday/birthday.php (line 133, 137, 142)

or:

/public_html/plugins/fabrik_element/birthday/forms/fields.xml
 
You were on the right track, it's actually an error in the code.

Around line 133 in birthday.php change the following.


Code:
            $days = array(JHTML::_('select.option', '', $params->get('[COLOR=Red]birthday__daylabel[/COLOR]', JText::_('Day'))));
            for ($i=1; $i < 32; $i++) {
                $days[] = JHTML::_('select.option', $i);
            }
            $months = array(JHTML::_('select.option', '', $params->get('[COLOR=Red]birthday_monthlabel[/COLOR]', JText::_('MONTH'))));
            //siin oli enne $monthlabels, viisin ?lespoole
            for ($i=0; $i<count($monthlabels); $i++) {
                $months[] = JHTML::_('select.option', $i+1, $monthlabels[$i]);
            }
            $years = array(JHTML::_('select.option', '', $params->get([COLOR=Red]'birthday_yearlabel[/COLOR]', JText::_('YEAR'))));
            $date = date('Y');
            $firstYear = (int)$params->get('[COLOR=Red]birthday_numyears[/COLOR]', 110);


These four changes will then meet the parameters set in

\plugins\fabrik_element\birthday\forms\fields.xml

Which will then allow you to set whatever case or word you want in


Here:-

9zobat.png
 
great, thanks for letting me know, i was wondering how these things end up in the releases!
 
hello,

i'm trying to make some adjustments to the birthday plugin so that the separator '/' displayed on the front end can also be specified in the plugins parameters.

i think there are three files to edit

in /public_html/plugins/fabrik_element/birthday/forms/fields.xml add:
Code:
<field name="birthday_separatorlabel" type="text" default="please select" label="PLG_ELEMENT_BIRTHDAY_SEPARATOR_LABEL" description="PLG_ELEMENT_BIRTHDAY_SEPARATOR_DESC" />
in /public_html/plugins/fabrik_element/birthday/language/en-GB/en-GB.plg_fabrik_element_birthday.ini add:
Code:
PLG_ELEMENT_BIRTHDAY_SEPARATOR_DESC="Select what you would like to use as a separator on the front end"
PLG_ELEMENT_BIRTHDAY_SEPARATOR_LABEL="Separator please select separator value"
and then in /public_html/plugins/fabrik_element/birthday/birthday.php replace:
Code:
$str[] = ' / '.JHTML::_('select.genericlist', $months, preg_replace('#(\[\])$#','[1]',$name), $attribs, 'value', 'text', $monthvalue);
$str[] = ' / '.JHTML::_('select.genericlist', $years, preg_replace('#(\[\])$#','[2]',$name), $attribs, 'value', 'text', $yearvalue);
with:

i'm not sure here, something like:
Code:
$str[] = ' .$params->get('birthday_separatorlabel', JText::_('/')). '.JHTML::_('select.genericlist', $months, preg_replace('#(\[\])$#','[1]',$name), $attribs, 'value', 'text', $monthvalue);
$str[] = ' .$params->get('birthday_separatorlabel', JText::_('/')) .'.JHTML::_('select.genericlist', $years, preg_replace('#(\[\])$#','[2]',$name), $attribs, 'value', 'text', $yearvalue);
i know that last bit is wrong, but the first two bits seem to be working!

can anyone please tell me how to reference this new addition in the birthday.php file?
 
when you do this

PHP:
JText::_('/')

Are you intentionally running '/' through JText ? Are you thinking that different languages have different default date separators?

As for the code, I think you have unclosed quotes in there which are going to give you errors, so try doing

PHP:
$str[] = $params->get('birthday_separatorlabel', JText::_('/')) . ' ' .JHTML::_('select.genericlist', $months, preg_replace('#(\[\])$#','[1]',$name), $attribs, 'value', 'text', $monthvalue);
</span>
 
hi rob,

no i was just trying to follow the precedent that was there in the code a little earlier that seemingly specified an 'alternative' with:
Code:
$days = array(JHTML::_('select.option', '', $params->get('birthday_daylabel', JText::_('DAY'))));
so my only hope with modifying this was to allow the user to specify the separator in the plugin parameters rather than having it hardcoded in the birthday.php file. so i think i got a little of a way there, i just needed to know how to call that text string instead of the '/' in birthday.php.

thanks very much for looking into this, will look at it asap in further detail, just knocking up some finishing touches to a wiki article at the moment!

thanks!
 
perfecto, that works! now separator can be defined from birthday plugin parameters! have committed it to github and made pull request! thanks!
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top