Added option to dynamicly set the sub-form layout from global options. Fixed bug in compiler that caused index warning.
This commit is contained in:
@ -5861,6 +5861,47 @@ abstract class ComponentbuilderHelper
|
||||
return $d && $d->format($format) == $date;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The subform layouts
|
||||
**/
|
||||
protected static $subformLayouts = false;
|
||||
|
||||
/**
|
||||
* get the subform layout
|
||||
*
|
||||
* @input string The view name
|
||||
* @input string The string name
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
public static function getSubformLayout($view, $field, $default = 'repeatablejcb')
|
||||
{
|
||||
// get global values
|
||||
if (self::$subformLayouts === false)
|
||||
{
|
||||
self::$subformLayouts = JComponentHelper::getParams('com_componentbuilder')->get('subform_layouts', false);
|
||||
}
|
||||
// check what we found (else) return default
|
||||
if (self::checkObject(self::$subformLayouts))
|
||||
{
|
||||
// looking for
|
||||
$target = $view . '.' . $field;
|
||||
foreach (self::$subformLayouts as $subform)
|
||||
{
|
||||
if ($target === $subform->view_field)
|
||||
{
|
||||
return $subform->layout;
|
||||
}
|
||||
elseif ('default' === $subform->view_field)
|
||||
{
|
||||
$default = $subform->layout;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the Composer Vendors
|
||||
|
Reference in New Issue
Block a user