Added validation rules resolve gh-254. Removed empty sql files. Improved the field area.

This commit is contained in:
2018-03-27 11:57:16 +02:00
parent 856a6fad3f
commit 0ba2a0e8cf
72 changed files with 5002 additions and 337 deletions

View File

@ -2083,6 +2083,15 @@ class Fields extends Structure
// get the actual field name
$xmlValue = $this->setPlaceholders($name, $placeholders);
}
elseif ($property['name'] === 'validate')
{
// check if we have validate (validation rule set)
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, 'validate="', '"');
if (ComponentbuilderHelper::checkString($xmlValue))
{
$xmlValue = ComponentbuilderHelper::safeString($xmlValue);
}
}
elseif ($property['name'] === 'extension' || $property['name'] === 'directory' || $property['name'] === 'formsource')
{
$xmlValue = ComponentbuilderHelper::getBetween($field['settings']->xml, $property['name'] . '="', '"');
@ -2290,6 +2299,16 @@ class Fields extends Structure
{
$fieldAttributes['display'] = $display;
}
// make sure validation is set if found (even it not part of field properties)
if (!isset($fieldAttributes['validate']))
{
// check if we have validate (validation rule set)
$validationRule = ComponentbuilderHelper::getBetween($field['settings']->xml, 'validate="', '"');
if (ComponentbuilderHelper::checkString($validationRule))
{
$fieldAttributes['validate'] = ComponentbuilderHelper::safeString($validationRule);
}
}
}
}
return $fieldAttributes;