Resolves gh-644 and addes the option to add, or hide the category sub-menu of a view.

This commit is contained in:
2021-01-06 12:02:55 +02:00
parent d9da5d9fc4
commit 12600431ca
16 changed files with 860 additions and 738 deletions

View File

@ -396,6 +396,37 @@ class ComponentbuilderModelAjax extends JModelList
return false;
}
public function checkCategoryField($type)
{
// get the view name & id
$values = $this->getViewID();
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray))
{
// get the fields
if ($fields = ComponentbuilderHelper::getVar('admin_fields', $values['a_id'], 'admin_view', 'addfields'))
{
// open the fields
if (ComponentbuilderHelper::checkJson($fields))
{
$fields = json_decode($fields, true);
if (ComponentbuilderHelper::checkArray($fields))
{
foreach($fields as $field)
{
if (isset($field['field']) &&
($field_values = ComponentbuilderHelper::getFieldNameAndType($field['field'])) !== false &&
$field_values['type'] === 'category' )
{
return true;
}
}
}
}
}
}
return false;
}
public function getDynamicScripts($type)
{
// get from global helper