Resolved gh-341 that adds the feature to expand the custom field option far beyond the default. Moved the menu prefix option in to the Joomla component area -> tab -> Settings to allow each component to override the global setting.

This commit is contained in:
2018-09-24 16:37:51 +02:00
parent e71ba204ca
commit 6ad253be44
57 changed files with 1324 additions and 813 deletions

View File

@ -2635,46 +2635,56 @@ class Get
{
return $field['type_name'];
}
// set the type name
$type_name = ComponentbuilderHelper::safeString($field['settings']->type_name);
// check that we have the poperties
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
{
foreach ($field['settings']->properties as $property)
// search for own custom fields
if (strpos($field['settings']->type_name, '@') !== false)
{
if ($property['name'] === 'type')
// set own custom field
$field['own_custom'] = $field['settings']->type_name;
$field['settings']->type_name = 'Custom';
}
// set the type name
$type_name = ComponentbuilderHelper::safeString($field['settings']->type_name);
// if custom (we must use the xml value)
if ($type_name === 'custom' || $type_name === 'customuser')
{
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
}
else
{
// loop over properties looking for the type value
foreach ($field['settings']->properties as $property)
{
// if custom (we must use the xml value)
if ($type_name === 'custom' || $type_name === 'customuser')
if ($property['name'] === 'type') // type field is never ajustable (unless custom)
{
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
// force the default value
if (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']))
{
$type = ComponentbuilderHelper::safeString($property['example']);
}
// fallback on type name set in name field
elseif (ComponentbuilderHelper::checkString($type_name))
{
$type = $type_name;
}
// fall back on the xml settings (not ideal)
else
{
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"'));
}
// exit foreach loop
break;
}
// use field core type (name)
elseif (ComponentbuilderHelper::checkString($type_name) || (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0))
{
$type = $type_name;
}
// make sure none adjustable fields are set (should be same as above) (TODO) hmmm we need look at this again
elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0)
{
$type = $property['example'];
}
// fall back on the xml settings (not ideal)
else
{
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"'));
}
// check if the value is set
if (ComponentbuilderHelper::checkString($type))
{
// add the value
return $type;
}
// exit foreach loop
break;
}
}
// check if the value is set
if (ComponentbuilderHelper::checkString($type))
{
// add the value
return $type;
}
}
// fall back to text
return 'text';