diff --git a/administrator/components/com_fields/models/fields/fieldcontexts.php b/administrator/components/com_fields/Field/FieldcontextsField.php similarity index 80% rename from administrator/components/com_fields/models/fields/fieldcontexts.php rename to administrator/components/com_fields/Field/FieldcontextsField.php index 7678f5a99c0d0..94a9ff138b4a8 100644 --- a/administrator/components/com_fields/models/fields/fieldcontexts.php +++ b/administrator/components/com_fields/Field/FieldcontextsField.php @@ -6,16 +6,20 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Fields\Administrator\Field; + defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); +use Joomla\CMS\Form\FormHelper; + +FormHelper::loadFieldClass('list'); /** * Fields Contexts * * @since 3.7.0 */ -class JFormFieldFieldcontexts extends JFormFieldList +class FieldcontextsField extends \JFormFieldList { public $type = 'Fieldcontexts'; @@ -43,7 +47,7 @@ protected function getOptions() { $parts = explode('.', $this->value); $eName = str_replace('com_', '', $parts[0]); - $file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $parts[0] . '/helpers/' . $eName . '.php'); + $file = \JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $parts[0] . '/helpers/' . $eName . '.php'); $contexts = array(); if (!file_exists($file)) @@ -54,7 +58,7 @@ protected function getOptions() $prefix = ucfirst($eName); $cName = $prefix . 'Helper'; - JLoader::register($cName, $file); + \JLoader::register($cName, $file); if (class_exists($cName) && is_callable(array($cName, 'getContexts'))) { diff --git a/administrator/components/com_fields/models/fields/fieldgroups.php b/administrator/components/com_fields/Field/FieldgroupsField.php similarity index 84% rename from administrator/components/com_fields/models/fields/fieldgroups.php rename to administrator/components/com_fields/Field/FieldgroupsField.php index cf92647ed746b..0e941a24ea95e 100644 --- a/administrator/components/com_fields/models/fields/fieldgroups.php +++ b/administrator/components/com_fields/Field/FieldgroupsField.php @@ -6,18 +6,22 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Fields\Administrator\Field; + defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Form\FormHelper; use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); +FormHelper::loadFieldClass('list'); /** * Fields Groups * * @since 3.7.0 */ -class JFormFieldFieldgroups extends JFormFieldList +class FieldgroupsField extends \JFormFieldList { public $type = 'Fieldgroups'; @@ -34,10 +38,10 @@ protected function getOptions() $states = $this->element['state'] ?: '0,1'; $states = ArrayHelper::toInteger(explode(',', $states)); - $user = JFactory::getUser(); + $user = Factory::getUser(); $viewlevels = ArrayHelper::toInteger($user->getAuthorisedViewLevels()); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('title AS text, id AS value, state'); $query->from('#__fields_groups'); diff --git a/administrator/components/com_fields/models/fields/modal/field.php b/administrator/components/com_fields/Field/Modal/FieldField.php similarity index 77% rename from administrator/components/com_fields/models/fields/modal/field.php rename to administrator/components/com_fields/Field/Modal/FieldField.php index 382f758848a9a..abf43c129def2 100644 --- a/administrator/components/com_fields/models/fields/modal/field.php +++ b/administrator/components/com_fields/Field/Modal/FieldField.php @@ -3,17 +3,22 @@ * @package Joomla.Administrator * @subpackage com_fields * - * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Fields\Administrator\Field\Modal; + defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Form\FormField; + /** * Fields Modal Field * * @since __DEPLOY_VERSION__ */ -class JFormFieldModal_Field extends JFormField +class FieldField extends FormField { protected $type = 'Modal_Field'; @@ -32,14 +37,14 @@ protected function getInput () } else { - $context = (string) JFactory::getApplication()->input->get('context', 'com_content'); + $context = (string) Factory::getApplication()->input->get('context', 'com_content'); } $allowEdit = ((string) $this->element['edit'] == 'true') ? true : false; $allowClear = ((string) $this->element['clear'] != 'false') ? true : false; // Load language - JFactory::getLanguage()->load('com_fields', JPATH_ADMINISTRATOR); + Factory::getLanguage()->load('com_fields', JPATH_ADMINISTRATOR); // Build the script. $script = array(); @@ -72,7 +77,7 @@ protected function getInput () $script[] = ' function jClearCategory(id) {'; $script[] = ' document.getElementById(id + "_id").value = "";'; $script[] = ' document.getElementById(id + "_name").value = "' . - htmlspecialchars(JText::_('COM_FIELDS_SELECT_A_FIELD', true), ENT_COMPAT, 'UTF-8') . '";'; + htmlspecialchars(\JText::_('COM_FIELDS_SELECT_A_FIELD', true), ENT_COMPAT, 'UTF-8') . '";'; $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");'; $script[] = ' if (document.getElementById(id + "_edit")) {'; $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");'; @@ -82,7 +87,7 @@ protected function getInput () } // Add the script to the document head. - JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); + Factory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); @@ -96,7 +101,7 @@ protected function getInput () if ((int) $this->value > 0) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('title')) ->from($db->quoteName('#__fields')) @@ -107,15 +112,15 @@ protected function getInput () { $title = $db->loadResult(); } - catch (RuntimeException $e) + catch (\RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + \JError::raiseWarning(500, $e->getMessage()); } } if (empty($title)) { - $title = JText::_('COM_FIELDS_SELECT_A_FIELD'); + $title = \JText::_('COM_FIELDS_SELECT_A_FIELD'); } $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); @@ -134,24 +139,24 @@ protected function getInput () $html[] = ''; $html[] = ''; $html[] = '' . ' ' . JText::_('JSELECT') . ''; + \JHtml::tooltipText('COM_FIELDS_CHANGE_FIELD') . '">' . ' ' . \JText::_('JSELECT') . ''; // Edit field button if ($allowEdit) { $html[] = '' . '' . JText::_('JACTION_EDIT') . + ' title="' . \JHtml::tooltipText('COM_FIELDS_EDIT_FIELD') . '" >' . '' . \JText::_('JACTION_EDIT') . ''; - $html[] = JHtml::_( + $html[] = \JHtml::_( 'bootstrap.renderModal', 'modalCategory-' . $this->id, array( - 'url' => $link . '&' . JSession::getFormToken() . '=1"', - 'title' => JText::_('COM_FIELDS_SELECT_A_FIELD'), + 'url' => $link . '&' . \JSession::getFormToken() . '=1"', + 'title' => \JText::_('COM_FIELDS_SELECT_A_FIELD'), 'width' => '800px', 'height' => '300px', - 'footer' => '' ) ); @@ -161,7 +166,7 @@ protected function getInput () if ($allowClear) { $html[] = '' . '' . JText::_('JCLEAR') . + ' onclick="return jClearCategory(\'' . $this->id . '\')">' . '' . \JText::_('JCLEAR') . ''; } diff --git a/administrator/components/com_fields/models/fields/section.php b/administrator/components/com_fields/Field/SectionField.php similarity index 60% rename from administrator/components/com_fields/models/fields/section.php rename to administrator/components/com_fields/Field/SectionField.php index 9532ac633c485..ac3db426ee0ea 100644 --- a/administrator/components/com_fields/models/fields/section.php +++ b/administrator/components/com_fields/Field/SectionField.php @@ -6,33 +6,38 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Fields\Administrator\Field; + defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); +use Joomla\CMS\Factory; +use Joomla\CMS\Form\FormHelper; + +FormHelper::loadFieldClass('list'); /** * Fields Section * * @since 3.7.0 */ -class JFormFieldSection extends JFormFieldList +class SectionField extends \JFormFieldList { public $type = 'Section'; /** * Method to attach a JForm object to the field. * - * @param SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. - * @param mixed $value The form field value to validate. - * @param string $group The field name group control value. This acts as an array container for the field. - * For example if the field has name="foo" and the group value is set to "bar" then the - * full field name would end up being "bar[foo]". + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @since 3.7.0 */ - public function setup(SimpleXMLElement $element, $value, $group = null) + public function setup(\SimpleXMLElement $element, $value, $group = null) { $return = parent::setup($element, $value, $group); @@ -53,7 +58,7 @@ public function setup(SimpleXMLElement $element, $value, $group = null) protected function getInput () { // Add the change context function to the document - JFactory::getDocument()->addScriptDeclaration( + Factory::getDocument()->addScriptDeclaration( "function fieldsChangeContext(context) { var regex = new RegExp(\"([?;&])context[^&;]*[;&]?\"); diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/Field/TypeField.php similarity index 63% rename from administrator/components/com_fields/models/fields/type.php rename to administrator/components/com_fields/Field/TypeField.php index aa24240595cdb..114802eb03717 100644 --- a/administrator/components/com_fields/models/fields/type.php +++ b/administrator/components/com_fields/Field/TypeField.php @@ -6,33 +6,39 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Fields\Administrator\Field; + defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); +use Joomla\CMS\Factory; +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Uri\Uri; + +FormHelper::loadFieldClass('list'); /** * Fields Type * * @since 3.7.0 */ -class JFormFieldType extends JFormFieldList +class TypeField extends \JFormFieldList { public $type = 'Type'; /** * Method to attach a JForm object to the field. * - * @param SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. - * @param mixed $value The form field value to validate. - * @param string $group The field name group control value. This acts as an array container for the field. - * For example if the field has name="foo" and the group value is set to "bar" then the - * full field name would end up being "bar[foo]". + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". * * @return boolean True on success. * * @since 3.7.0 */ - public function setup(SimpleXMLElement $element, $value, $group = null) + public function setup(\SimpleXMLElement $element, $value, $group = null) { $return = parent::setup($element, $value, $group); @@ -52,11 +58,11 @@ protected function getOptions() { $options = parent::getOptions(); - $fieldTypes = FieldsHelper::getFieldTypes(); + $fieldTypes = \FieldsHelper::getFieldTypes(); foreach ($fieldTypes as $fieldType) { - $options[] = JHtml::_('select.option', $fieldType['type'], $fieldType['label']); + $options[] = \JHtml::_('select.option', $fieldType['type'], $fieldType['label']); } // Sorting the fields based on the text which is displayed @@ -69,11 +75,11 @@ function ($a, $b) ); // Reload the page when the type changes - $uri = clone JUri::getInstance('index.php'); + $uri = clone Uri::getInstance('index.php'); // Removing the catid parameter from the actual URL and set it as // return - $returnUri = clone JUri::getInstance(); + $returnUri = clone Uri::getInstance(); $returnUri->setVar('catid', null); $uri->setVar('return', base64_encode($returnUri->toString())); @@ -87,7 +93,7 @@ function ($a, $b) $uri->setVar('layout', null); - JFactory::getDocument()->addScriptDeclaration(" + Factory::getDocument()->addScriptDeclaration(" jQuery( document ).ready(function() { Joomla.loadingLayer('load'); }); diff --git a/administrator/components/com_fields/forms/field.xml b/administrator/components/com_fields/forms/field.xml index b2fd1ca6ba7d7..02ec1e5a9aed2 100644 --- a/administrator/components/com_fields/forms/field.xml +++ b/administrator/components/com_fields/forms/field.xml @@ -1,6 +1,6 @@ -
-
+ +
diff --git a/administrator/components/com_fields/forms/filter_fields.xml b/administrator/components/com_fields/forms/filter_fields.xml index 4e457af445ab2..cc2d8885b71da 100644 --- a/administrator/components/com_fields/forms/filter_fields.xml +++ b/administrator/components/com_fields/forms/filter_fields.xml @@ -1,5 +1,5 @@ - +
diff --git a/administrator/components/com_fields/forms/filter_groups.xml b/administrator/components/com_fields/forms/filter_groups.xml index 4526bab635ef0..e3f37c57c839a 100644 --- a/administrator/components/com_fields/forms/filter_groups.xml +++ b/administrator/components/com_fields/forms/filter_groups.xml @@ -1,5 +1,5 @@ - +
- +
-