function claro_form_menu_link_content_form_alter
Same name in other branches
- 10 core/themes/claro/claro.theme \claro_form_menu_link_content_form_alter()
Implements hook_form_BASE_FORM_ID_alter() for MenuLinkContentForm.
Alters the menu_link_content_form by organizing form elements into different 'details' sections.
1 call to claro_form_menu_link_content_form_alter()
- claro_form_menu_link_edit_alter in core/
themes/ claro/ claro.theme - Implements hook_form_FORM_ID_alter() for MenuLinkEditForm.
File
-
core/
themes/ claro/ claro.theme, line 692
Code
function claro_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state) {
$form['#theme'] = [
'menu_link_form',
];
$form['#attached']['library'][] = 'claro/form-two-columns';
$form['advanced'] = [
'#type' => 'container',
'#weight' => 10,
'#accordion' => TRUE,
];
$form['menu_parent']['#wrapper_attributes'] = [
'class' => [
'accordion__item',
'entity-meta__header',
],
];
$form['menu_parent']['#prefix'] = '<div class="accordion">';
$form['menu_parent']['#suffix'] = '</div>';
$form['menu_parent']['#group'] = 'advanced';
$form['menu_link_display_settings'] = [
'#type' => 'details',
'#group' => 'advanced',
'#title' => t('Display settings'),
'#attributes' => [
'class' => [
'entity-meta__options',
],
],
'#tree' => TRUE,
'#accordion' => TRUE,
];
if (!empty($form['weight'])) {
$form['menu_link_display_settings']['weight'] = $form['weight'];
unset($form['weight'], $form['menu_link_display_settings']['weight']['#weight']);
}
if (!empty($form['expanded'])) {
$form['menu_link_display_settings']['expanded'] = $form['expanded'];
unset($form['expanded']);
}
if (isset($form['description'])) {
$form['menu_link_description'] = [
'#type' => 'details',
'#group' => 'advanced',
'#title' => t('Description'),
'#attributes' => [
'class' => [
'entity-meta__description',
],
],
'#tree' => TRUE,
'#accordion' => TRUE,
'description' => $form['description'],
];
unset($form['description']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.