diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index e3345c0a69f90..533f2c382126e 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -53,7 +53,7 @@ public static function extract($contextString) * Should the value being prepared to be shown in an HTML context then * prepareValue must be set to true. No further escaping needs to be done. * The values of the fields can be overridden by an associative array where the keys - * can be an id or an alias and it's corresponding value. + * has to be an id or and it's corresponding value. * * @param string $context The context of the content passed to the helper * @param stdClass $item item @@ -326,7 +326,7 @@ public static function prepareForm($context, JForm $form, $data) // Creating the dom $xml = new DOMDocument('1.0', 'UTF-8'); $fieldsNode = $xml->appendChild(new DOMElement('form'))->appendChild(new DOMElement('fields')); - $fieldsNode->setAttribute('name', 'params'); + $fieldsNode->setAttribute('name', 'com_fields'); // Organizing the fields according to their group $fieldsPerGroup = array( @@ -478,7 +478,7 @@ public static function prepareForm($context, JForm $form, $data) if (!is_array($value) && $value !== '') { // Function getField doesn't cache the fields, so we try to do it only when necessary - $formField = $form->getField($field->id, 'params'); + $formField = $form->getField($field->id, 'com_fields'); if ($formField && $formField->forceMultiple) { @@ -487,7 +487,7 @@ public static function prepareForm($context, JForm $form, $data) } // Setting the value on the field - $form->setValue($field->id, 'params', $value); + $form->setValue($field->id, 'com_fields', $value); } return true; diff --git a/components/com_contact/controllers/contact.php b/components/com_contact/controllers/contact.php index 9dfba0bee2546..54fa488afc94b 100644 --- a/components/com_contact/controllers/contact.php +++ b/components/com_contact/controllers/contact.php @@ -199,7 +199,7 @@ private function _sendEmail($data, $contact, $copy_email_activated) $body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body); // Load the custom fields - if ($data['params'] && $fields = FieldsHelper::getFields('com_contact.mail', $contact, true, $data['params'])) + if ($data['com_fields'] && $fields = FieldsHelper::getFields('com_contact.mail', $contact, true, $data['com_fields'])) { $output = FieldsHelper::render( 'com_contact.mail', diff --git a/libraries/joomla/form/field.php b/libraries/joomla/form/field.php index 235254ebf6fb3..68ef25b45ff91 100644 --- a/libraries/joomla/form/field.php +++ b/libraries/joomla/form/field.php @@ -1082,11 +1082,11 @@ public function appendXMLFieldTag($field, DOMElement $parent, JForm $form) { $app = JFactory::getApplication(); - if ($field->params->get('show_on') == 1 && $app->isAdmin()) + if ($field->params->get('show_on') == 1 && $app->isClient('administrator')) { return; } - elseif ($field->params->get('show_on') == 2 && $app->isSite()) + elseif ($field->params->get('show_on') == 2 && $app->isClient('site')) { return; } diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index 2e70d62813e9e..cc9042ed0cac2 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -58,43 +58,24 @@ public function onContentBeforeSave($context, $item, $isNew) return true; } - $params = new Registry; - - // Load the item params from the request + // Load the fields data from the request $data = JFactory::getApplication()->input->post->get('jform', array(), 'array'); - if (key_exists('params', $data)) - { - $params->loadArray($data['params']); - } - - // Load the params from the item itself - if (isset($item->params)) + if (!key_exists('com_fields', $data)) { - $params->loadString($item->params); + return true; } - $params = $params->toArray(); - // Create the new internal fields field - $fields = array(); + $item->_fields = array(); foreach ($fieldsObjects as $field) { - // Set the param on the fields variable - $fields[$field->id] = key_exists($field->id, $params) ? $params[$field->id] : array(); - - // Remove it from the params array - unset($params[$field->id]); + // Set the field data on the fields variable + $item->_fields[$field->id] = key_exists($field->id, $data['com_fields']) ? $data['com_fields'][$field->id] : array(); } - $item->_fields = $fields; - - // Update the cleaned up params - if (isset($item->params)) - { - $item->params = json_encode($params); - } + unset ($data['com_fields']); return true; } @@ -300,31 +281,6 @@ public function onContentPrepareForm(JForm $form, $data) return true; } - /** - * The prepare data event. - * - * @param string $context The context - * @param stdClass $data The data - * - * @return void - * - * @since __DEPLOY_VERSION__ - */ - public function onContentPrepareData($context, $data) - { - $parts = $this->getParts($context); - - if (!$parts) - { - return; - } - - if (isset($data->params) && $data->params instanceof Registry) - { - $data->params = $data->params->toArray(); - } - } - /** * The display event. *