Per this from the Wiki....
There are two options available for making contributions to Fabrik in the form of code submissions, bug fixes and language files:
Personally, I would prefer that these new labels be created/displayed as 'proper names' - i.e. user_name becomes "User Name".
So I wrote the code needed to create a new global default setting to determine just how those labels will get created. It is very simple and basic and I hope someone who contributes to github will add my code - as I'm sure many other Fabrik users would welcome this added feature.
Add this to create a new fieldset (tab) in the Fabrik global configuration. (Put this between the 'elements' and 'forms' fieldset tags in administrator/components/com_fabrik/config.xml - to create a new tab named 'labels' which the language file labels as "Labels".)
Sorry, I only changed the English language file - but for example, this would be added to
the bottom of administrator/components/com_fabrik/language/en-GB/en-GB.com_fabrik.ini ...
Then finally, in administrator/components/com_fabrik/models/list.php - in protected function makeElementsFromFields() - Near the bottom of the function, just above the line $element->store();
Insert this code...
I have tested and it works as expected.
There are two options available for making contributions to Fabrik in the form of code submissions, bug fixes and language files:
- Create your contribution on your own system and send the updated files to the developers via the forums.
Personally, I would prefer that these new labels be created/displayed as 'proper names' - i.e. user_name becomes "User Name".
So I wrote the code needed to create a new global default setting to determine just how those labels will get created. It is very simple and basic and I hope someone who contributes to github will add my code - as I'm sure many other Fabrik users would welcome this added feature.
Add this to create a new fieldset (tab) in the Fabrik global configuration. (Put this between the 'elements' and 'forms' fieldset tags in administrator/components/com_fabrik/config.xml - to create a new tab named 'labels' which the language file labels as "Labels".)
Code:
<fieldset label="COM_FABRIK_LABELS" name="labels">
<field name="format_labels"
type="radio"
default="0"
description="COM_FABRIK_LABELS_DESC"
label="COM_FABRIK_LABELS_LABEL">
<option value="0">COM_FABRIK_LABELS_DEFAULT</option>
<option value="1">COM_FABRIK_LABELS_LOWERCASE</option>
<option value="2">COM_FABRIK_LABELS_UCWORDS</option>
<option value="3">COM_FABRIK_LABELS_CAPFIRST</option>
<option value="4">COM_FABRIK_LABELS_CAPS</option>
</field>
</fieldset>
the bottom of administrator/components/com_fabrik/language/en-GB/en-GB.com_fabrik.ini ...
Code:
COM_FABRIK_LABELS="Labels"
COM_FABRIK_LABELS_LABEL="Default action for creation of labels"
COM_FABRIK_LABELS_DESC="When you create a new list from an existing database table, new elements are automatically created and the label becomes the element name with any underscores replaced with a space. Set the default formatting used to create these element labels below."
COM_FABRIK_LABELS_DEFAULT="Default (e.g. user_Name becomes 'user Name')"
COM_FABRIK_LABELS_LOWERCASE="Lowercase (e.g. user_Name becomes 'user name')"
COM_FABRIK_LABELS_UCWORDS="Proper name (e.g. user_Name becomes 'User Name')"
COM_FABRIK_LABELS_CAPFIRST="Capitalize first letter (e.g. user_Name becomes 'User name')"
COM_FABRIK_LABELS_CAPS="All Caps (e.g. user_name becomes 'USER NAME')"
Insert this code...
PHP:
//Format Label
$labelConfig = $fbConfig->get('format_labels','0');
switch($labelConfig)
{
case '1':
$element->label = strtolower($element->label);
break;
case '2':
$element->label = ucwords($element->label);
break;
case '3':
$element->label = ucfirst($element->label);
break;
case '4':
$element->label = strtoupper($element->label);
break;
default:
break;
}