chg: [ui:generic_index] Only show enabled meta-templates in table options
parent
9506142de5
commit
715ba1d75b
|
@ -142,6 +142,9 @@ class CRUDComponent extends Component
|
|||
$data[$i] = $this->attachMetaTemplatesIfNeeded($row, $metaTemplates);
|
||||
}
|
||||
$this->Controller->set('meta_templates', $metaTemplates);
|
||||
$this->Controller->set('meta_templates_enabled', array_filter($metaTemplates, function($template) {
|
||||
return $template['enabled'];
|
||||
}));
|
||||
}
|
||||
if (true) { // check if stats are requested
|
||||
$modelStatistics = [];
|
||||
|
|
|
@ -2008,6 +2008,12 @@ class BoostrapDropdownMenu extends BootstrapGeneric
|
|||
}
|
||||
|
||||
$classes = ['dropdown-item'];
|
||||
if (!empty($entry['class'])) {
|
||||
if (!is_array($entry['class'])) {
|
||||
$entry['class'] = [$entry['class']];
|
||||
}
|
||||
$classes = array_merge($classes, $entry['class']);
|
||||
}
|
||||
$params = ['href' => '#'];
|
||||
|
||||
if (!empty($entry['menu'])) {
|
||||
|
|
|
@ -19,7 +19,10 @@ $availableColumnsHtml = $this->element('/genericElements/ListTopBar/group_table_
|
|||
$metaTemplateColumnMenu = [];
|
||||
if (!empty($meta_templates)) {
|
||||
$metaTemplateColumnMenu[] = ['header' => true, 'text' => __('Meta Templates'), 'icon' => 'object-group',];
|
||||
foreach ($meta_templates as $meta_template) {
|
||||
if (empty($meta_templates_enabled)) {
|
||||
$metaTemplateColumnMenu[] = ['header' => false, 'text' => __('- No enabled Meta Templates found -'), 'class' => ['disabled', 'muted']];
|
||||
} else {
|
||||
foreach ($meta_templates_enabled as $meta_template) {
|
||||
$numberActiveMetaField = !empty($tableSettings['visible_meta_column'][$meta_template->id]) ? count($tableSettings['visible_meta_column'][$meta_template->id]) : 0;
|
||||
$metaTemplateColumnMenu[] = [
|
||||
'text' => $meta_template->name,
|
||||
|
@ -42,6 +45,7 @@ if (!empty($meta_templates)) {
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$indexColumnMenu = array_merge(
|
||||
[['header' => true, 'text' => sprintf('%s\'s fields', $this->request->getParam('controller'))]],
|
||||
[['html' => $availableColumnsHtml]],
|
||||
|
|
Loading…
Reference in New Issue