Skip to content

Commit

Permalink
Add option to disable custom fields per component
Browse files Browse the repository at this point in the history
Closes joomla#87
  • Loading branch information
laoneo committed Jun 4, 2016
1 parent 18496c0 commit 165a58e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 19 deletions.
12 changes: 12 additions & 0 deletions administrator/components/com_content/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,18 @@
<option value="0">JNO</option>
</field>

<field
name="custom_fields_enable"
type="radio"
class="btn-group btn-group-yesno"
label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL"
description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC"
default="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>

</fieldset>

<fieldset
Expand Down
23 changes: 14 additions & 9 deletions administrator/components/com_content/helpers/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ public static function addSubmenu($vName)
JText::_('COM_CONTENT_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_content',
$vName == 'categories');
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_content.article',
$vName == 'fields.article'
);
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_categories&extension=com_content.article.fields',
$vName == 'categories.article');

if (JComponentHelper::getComponent('com_content')->params->get('custom_fields_enable', '1'))
{
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_content.article',
$vName == 'fields.article'
);
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_categories&extension=com_content.article.fields',
$vName == 'categories.article');
}

JHtmlSidebar::addEntry(
JText::_('COM_CONTENT_SUBMENU_FEATURED'),
'index.php?option=com_content&view=featured',
Expand Down
12 changes: 12 additions & 0 deletions administrator/components/com_users/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@
<option value="0">JNO</option>
</field>

<field
name="custom_fields_enable"
type="radio"
class="btn-group btn-group-yesno"
label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL"
description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC"
default="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>

</fieldset>

<fieldset
Expand Down
23 changes: 13 additions & 10 deletions administrator/components/com_users/helpers/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,19 @@ public static function addSubmenu($vName)
);
}

JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_users.user',
$vName == 'fields.user'
);
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_categories&extension=com_users.user.fields',
$vName == 'categories.user'
);
if (JComponentHelper::getComponent('com_users')->params->get('custom_fields_enable', '1'))
{
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_users.user',
$vName == 'fields.user'
);
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_categories&extension=com_users.user.fields',
$vName == 'categories.user'
);
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ JGLOBAL_SECRETKEY="Secret Key"
JGLOBAL_SECRETKEY_HELP="If you have enabled two factor authentication in your user account please enter your secret key. If you do not know what this means, you can leave this field blank."
JGLOBAL_SEF_ADVANCED_DESC="This uses the new URL routing. This may change your URLs!"
JGLOBAL_SEF_ADVANCED_LABEL="Use new URL routing"
JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC="Enable custom fields."
JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL="Enable Custom Fields"
JGLOBAL_SELECT_ALLOW_DENY_GROUP="Change %s permission for %s group."
JGLOBAL_SELECT_AN_OPTION="Select an option"
JGLOBAL_SELECT_NO_RESULTS_MATCH="No results match"
Expand Down

0 comments on commit 165a58e

Please sign in to comment.