Skip to content

Commit

Permalink
[4.0] Fix namespaced form fields Part 2 (#17664)
Browse files Browse the repository at this point in the history
* Fix namespaced form fields

* Fix tests and improve doc blocks
  • Loading branch information
laoneo authored and wilsonge committed Aug 22, 2017
1 parent ade0230 commit 99fa8be
Show file tree
Hide file tree
Showing 32 changed files with 98 additions and 69 deletions.
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/CalendarField.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -155,7 +155,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/CaptchaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/CheckboxField.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -95,7 +95,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/CheckboxesField.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function getInput()
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -128,7 +128,7 @@ protected function getInput()
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/ChromeStyleField.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -92,7 +92,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/ColorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -155,7 +155,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/EditorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/FileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -99,7 +99,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
18 changes: 9 additions & 9 deletions libraries/src/CMS/Form/Field/FilelistField.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` 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 `<field>` 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.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down Expand Up @@ -202,12 +202,12 @@ protected function getOptions()
// Prepend some default options based on field attributes.
if (!$this->hideNone)
{
$options[] = \JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
$options[] = \JHtml::_('select.option', '-1', \JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}

if (!$this->hideDefault)
{
$options[] = \JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
$options[] = \JHtml::_('select.option', '', \JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}

// Get a list of files in the search path with the given filter.
Expand Down
18 changes: 9 additions & 9 deletions libraries/src/CMS/Form/Field/FolderlistField.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` 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 `<field>` 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.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down Expand Up @@ -198,12 +198,12 @@ protected function getOptions()
// Prepend some default options based on field attributes.
if (!$this->hideNone)
{
$options[] = \JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
$options[] = \JHtml::_('select.option', '-1', \JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}

if (!$this->hideDefault)
{
$options[] = \JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
$options[] = \JHtml::_('select.option', '', \JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
}

// Get a list of folders in the search path with the given filter.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/MediaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/MenuitemField.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/MeterField.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -135,7 +135,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/ModuleOrderField.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/ModulePositionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/NumberField.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/OrderingField.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/PasswordField.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/CMS/Form/Field/PluginsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand All @@ -90,7 +90,7 @@ public function __set($name, $value)
*
* @return boolean True on success.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/RulesField.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
19 changes: 10 additions & 9 deletions libraries/src/CMS/Form/Field/SqlField.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;

FormHelper::loadFieldClass('list');
Expand Down Expand Up @@ -111,17 +112,17 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` 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 `<field>` 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.
*
* @see JFormField::setup()
* @see FormField::setup()
* @since 3.2
*/
public function setup(\SimpleXMLElement $element, $value, $group = null)
Expand Down Expand Up @@ -190,7 +191,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
* @param string $filters The columns to filter.
* @param array $defaults The defaults value to set if condition is empty.
*
* @return JDatabaseQuery The query object.
* @return \JDatabaseQuery The query object.
*
* @since 3.5
*/
Expand Down Expand Up @@ -306,7 +307,7 @@ protected function getOptions()
{
if ($this->translate == true)
{
$options[] = \JHtml::_('select.option', $item->$key, JText::_($item->$value));
$options[] = \JHtml::_('select.option', $item->$key, \JText::_($item->$value));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/SubformField.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/TemplatestyleField.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/CMS/Form/Field/TextField.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function __set($name, $value)
}

/**
* Method to attach a JForm object to the field.
* Method to attach a Form object to the field.
*
* @param \SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object.
* @param mixed $value The form field value to validate.
Expand Down
Loading

0 comments on commit 99fa8be

Please sign in to comment.