Improved the plugin form builder, to allow multi form field relationships.

This commit is contained in:
2019-08-22 03:54:47 +02:00
parent c13c752abb
commit d2f94d84fa
65 changed files with 1225 additions and 431 deletions

View File

@ -5670,7 +5670,7 @@ abstract class ComponentbuilderHelper
* @return object
*
*/
public static function getFieldObject($attributes, $default = '', $options = null)
public static function getFieldObject(&$attributes, $default = '', $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes) && isset($attributes['type']))
@ -5681,7 +5681,31 @@ abstract class ComponentbuilderHelper
jimport('joomla.form.form');
}
// get field type
$field = JFormHelper::loadFieldType($attributes['type'],true);
$field = JFormHelper::loadFieldType($attributes['type'], true);
// get field xml
$XML = self::getFieldXML($attributes, $options);
// setup the field
$field->setup($XML, $default);
// return the field object
return $field;
}
return false;
}
/**
* get the field xml
*
* @param array $attributes The array of attributes
* @param array $options The options to apply to the XML element
*
* @return object
*
*/
public static function getFieldXML(&$attributes, $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes))
{
// start field xml
$XML = new SimpleXMLElement('<field/>');
// load the attributes
@ -5692,10 +5716,8 @@ abstract class ComponentbuilderHelper
// load the options
self::xmlAddOptions($XML, $options);
}
// setup the field
$field->setup($XML, $default);
// return the field object
return $field;
// return the field xml
return $XML;
}
return false;
}