Urgent fix to the fields area to address the extra field options, and fields with 0 being removed. Added the option to add a field and not add it to the database, so it will show in the edit view but will not be stored to the database. This is to use javascript/php to use that field value, and then drop it.

This commit is contained in:
2018-04-13 17:24:06 +02:00
parent 51d13b75f0
commit 694612aff9
31 changed files with 515 additions and 300 deletions

View File

@ -891,6 +891,8 @@ class ComponentbuilderModelField extends JModelAdmin
// get the properties
$properties = $input->get('properties', null, 'ARRAY');
// get the extra properties
$extraproperties = $input->get('extraproperties', null, 'ARRAY');
// make sure we have an array
if (ComponentbuilderHelper::checkArray($properties))
{
@ -899,9 +901,7 @@ class ComponentbuilderModelField extends JModelAdmin
foreach($properties as $property)
{
// make sure we have the correct values
if (ComponentbuilderHelper::checkArray($property) &&
isset($property['name']) && ComponentbuilderHelper::checkString($property['name']) &&
isset($property['value']) && ComponentbuilderHelper::checkString($property['value']))
if (ComponentbuilderHelper::checkArray($property) && isset($property['name']) && ComponentbuilderHelper::checkString($property['name']) && isset($property['value']))
{
// fix the name
$property['name'] = ComponentbuilderHelper::safeString($property['name']);
@ -918,6 +918,19 @@ class ComponentbuilderModelField extends JModelAdmin
$bucket[] = "\t".$property['name'].'="'. str_replace('"', """, $property['value']).'"';
}
}
// make sure we have an array
if (ComponentbuilderHelper::checkArray($extraproperties))
{
foreach($extraproperties as $xproperty)
{
// make sure we have the correct values
if (ComponentbuilderHelper::checkArray($xproperty) && isset($xproperty['name']) && ComponentbuilderHelper::checkString($xproperty['name']) && isset($xproperty['value']))
{
// load the extra property
$bucket[] = "\t".ComponentbuilderHelper::safeString($xproperty['name']).'="'. str_replace('"', """, $xproperty['value']).'"';
}
}
}
// if the bucket has been loaded
if (ComponentbuilderHelper::checkArray($bucket))
{