You are here

public function CheeseburgerMenu::buildMenuItemFormElement in Cheeseburger Menu 8.4

Returns default menu form element.

1 call to CheeseburgerMenu::buildMenuItemFormElement()
CheeseburgerMenu::blockForm in src/Plugin/Block/CheeseburgerMenu.php
Block form.

File

src/Plugin/Block/CheeseburgerMenu.php, line 370
Cheeseburger class extends BlockBase.

Class

CheeseburgerMenu
Block info.

Namespace

Drupal\cheeseburger_menu\Plugin\Block

Code

public function buildMenuItemFormElement($machine_name, $label) {
  $form[$machine_name]['show'] = [
    '#type' => 'checkbox',
    '#prefix' => '<div class="container-inline">',
    '#title' => $label,
    '#default_value' => (int) $this->configuration[$machine_name]['show'],
  ];
  $form[$machine_name]['menu_weight'] = [
    '#type' => 'weight',
    '#default_value' => $this->configuration[$machine_name]['menu_weight'],
    '#suffix' => '</div>',
    '#states' => [
      'invisible' => [
        ':input[name="settings[' . $machine_name . '][show]"]' => [
          'checked' => FALSE,
        ],
      ],
    ],
  ];
  return $form;
}