Skip to content

Commit

Permalink
implement inherit value in fields + language things
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruud68 committed Apr 4, 2018
1 parent 2738876 commit 602cc08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions administrator/components/com_fields/helpers/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,15 @@ public static function displayFieldOnForm($field)
{
$groupModel = JModelLegacy::getInstance('Group', 'FieldsModel', array('ignore_request' => true));
$groupDisplayReadOnly = $groupModel->getItem($field->group_id)->params->get('display_readonly', '1');
$fieldDisplayReadOnly = $field->params->get('display_readonly', '1');
$fieldDisplayReadOnly = $field->params->get('display_readonly', '2');

if (($groupDisplayReadOnly == 0 || $fieldDisplayReadOnly == 0))
if ($fieldDisplayReadOnly == '2')
{
// Inherit from field group display read-only setting
$fieldDisplayReadOnly = $groupDisplayReadOnly;
}

if ($fieldDisplayReadOnly == '0')
{
// Do not display field on form when field is read-only
return false;
Expand Down
3 changes: 2 additions & 1 deletion administrator/components/com_fields/models/forms/field.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,11 @@
label="JFIELD_DISPLAY_READONLY_LABEL"
description="JFIELD_DISPLAY_READONLY_DESC"
class="btn-group btn-group-yesno"
default="1"
default="2"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
<option value="2">JGLOBAL_INHERIT</option>
</field>
</fieldset>
</fields>
Expand Down
4 changes: 2 additions & 2 deletions administrator/language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ JFIELD_BASIS_LOGOUT_DESCRIPTION_LABEL="Logout Description Text"
JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC="Show or hide logout description."
JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_LABEL="Logout Description"
JFIELD_CATEGORY_DESC="The category that this item is assigned to. You may select an existing category or enter a new category by typing the name in the field and pressing enter."
JFIELD_DISPLAY_READONLY_DESC="Select whether to display the field on forms when read-only."
JFIELD_DISPLAY_READONLY_LABEL="Display when read-only"
JFIELD_DISPLAY_READONLY_DESC="Whether to display the field on forms when read-only. Inherit defaults to value set in field group."
JFIELD_DISPLAY_READONLY_LABEL="Display When Read-Only"
JFIELD_ENABLED_DESC="The enabled status of this item."
JFIELD_FIELDS_CATEGORY_DESC="Select the category that this field is assigned to."
JFIELD_KEY_REFERENCE_DESC="Used to store information referring to an external resource."
Expand Down

0 comments on commit 602cc08

Please sign in to comment.