@@ -107,6 +107,36 @@ public function blockForm($form, FormStateInterface $form_state) {
'#description'=>$this->t('Override the option found on each menu link used for expanding children and instead display the whole menu tree as expanded.'),
];
// When only the first level of links are shown, or if all links are
// expanded, the active trail logic can be skipped.
$state_conditions=[
// When the menu level starts at anything other than 1.
'#description'=>$this->t('Adds a CSS class to parent menu links when the current page is in the menu. This feature has a performance impact and should only be enabled when the menu appearance should differ based on the current page.'),
'#states'=>[
'required'=>$state_conditions,
],
];
return$form;
}
@@ -120,6 +150,20 @@ public static function processMenuLevelParents(&$element, FormStateInterface $fo
$form_state->setError($form['menu_levels']['add_active_trail_class'],$this->t('"Add a CSS class to ancestors of the current page" is required if the menu if the initial is 1, or if menu items are not all expanded and the number of levels display is more than 1.'));
}
}
/**
* {@inheritdoc}
*/
@@ -127,6 +171,16 @@ public function blockSubmit($form, FormStateInterface $form_state) {
publicstring$message='The "ignore_active_trail" setting on a system menu block cannot be enabled if "level" is greater than 1 or "expand_all_items" is not enabled and "depth" is greater than 1.';