Removed required from all code/editor field to improve the behavior of the codemirror editor. Improved the token validation via Ajax.
This commit is contained in:
@ -456,42 +456,6 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to validate the form data.
|
||||
*
|
||||
* @param JForm $form The form to validate against.
|
||||
* @param array $data The data to validate.
|
||||
* @param string $group The name of the field group to validate.
|
||||
*
|
||||
* @return mixed Array of filtered data if valid, false otherwise.
|
||||
*
|
||||
* @see JFormRule
|
||||
* @see JFilterInput
|
||||
* @since 12.2
|
||||
*/
|
||||
public function validate($form, $data, $group = null)
|
||||
{
|
||||
// check if the not_required field is set
|
||||
if (ComponentbuilderHelper::checkString($data['not_required']))
|
||||
{
|
||||
$requiredFields = (array) explode(',',(string) $data['not_required']);
|
||||
$requiredFields = array_unique($requiredFields);
|
||||
// now change the required field attributes value
|
||||
foreach ($requiredFields as $requiredField)
|
||||
{
|
||||
// make sure there is a string value
|
||||
if (ComponentbuilderHelper::checkString($requiredField))
|
||||
{
|
||||
// change to false
|
||||
$form->setFieldAttribute($requiredField, 'required', 'false');
|
||||
// also clear the data set
|
||||
$data[$requiredField] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent::validate($form, $data, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the unique fields of this table.
|
||||
*
|
||||
|
Reference in New Issue
Block a user