diff --git a/administrator/components/com_fields/models/field.php b/administrator/components/com_fields/models/field.php index 28da33a686e84..45debf58b2216 100644 --- a/administrator/components/com_fields/models/field.php +++ b/administrator/components/com_fields/models/field.php @@ -920,6 +920,7 @@ protected function loadFormData() protected function preprocessForm(JForm $form, $data, $group = 'content') { $component = $this->state->get('field.component'); + $section = $this->state->get('field.section'); $dataObject = $data; if (is_array($dataObject)) @@ -967,6 +968,21 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $form->setFieldAttribute('group_id', 'context', $this->state->get('field.context')); $form->setFieldAttribute('rules', 'component', $component); + // Looking first in the component models/forms folder + $path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/forms/fields/' . $section . '.xml'); + + if (file_exists($path)) + { + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true); + $lang->load($component, JPATH_BASE . '/components/' . $component, null, false, true); + + if (!$form->loadFile($path, false)) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + // Trigger the default form events. parent::preprocessForm($form, $data, $group); } diff --git a/administrator/components/com_users/models/forms/fields/user.xml b/administrator/components/com_users/models/forms/fields/user.xml new file mode 100644 index 0000000000000..98d35641ba6cf --- /dev/null +++ b/administrator/components/com_users/models/forms/fields/user.xml @@ -0,0 +1,12 @@ + +
+ +
+ +
+
+