Improved the plugin form builder, to allow multi form field relationships.
This commit is contained in:
@ -774,7 +774,31 @@ abstract class ###Component###Helper
|
||||
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
|
||||
@ -785,10 +809,8 @@ abstract class ###Component###Helper
|
||||
// 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;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ abstract class ###Component###Helper
|
||||
* @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']))
|
||||
@ -417,7 +417,31 @@ abstract class ###Component###Helper
|
||||
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
|
||||
@ -428,10 +452,8 @@ abstract class ###Component###Helper
|
||||
// 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;
|
||||
}
|
||||
|
@ -242,6 +242,8 @@ class ###Component###Model###View### extends JModelAdmin
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_###component###.###view###', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -242,6 +242,8 @@ class ###Component###Model###View### extends JModelAdmin
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_###component###.###view###', $data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
Reference in New Issue
Block a user