You are here

public function SmartMenusBlock::blockForm in Smartmenus.js 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/SmartMenusBlock.php, line 103

Class

SmartMenusBlock
Provides a 'SmartMenusBlock' block.

Namespace

Drupal\smartmenus\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $form['smartmenus'] = array(
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Smartmenus Settings'),
  );
  $form['smartmenus']['smartmenus_menu'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Menu'),
    '#options' => menu_ui_get_menus(),
    '#description' => t('The desired menu to render as a Smartmenu.'),
    '#default_value' => $config['smartmenus_menu'] ? $config['smartmenus_menu'] : '',
    '#required' => TRUE,
  );
  $form['smartmenus']['smartmenus_toggle'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display a menu toggle button on small screens'),
    '#default_value' => $config['smartmenus_toggle'] ? $config['smartmenus_toggle'] : '',
  );
  $form['smartmenus']['smartmenus_orient'] = array(
    '#type' => 'radios',
    '#title' => $this
      ->t('Orientation'),
    '#options' => array(
      'vertical' => $this
        ->t('Vertical'),
      'horizontal' => $this
        ->t('Horizontal'),
    ),
    '#default_value' => $config['smartmenus_orient'] ? $config['smartmenus_orient'] : 'horizontal',
  );
  $form['smartmenus']['smartmenus_theme'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Smart menus theme'),
    '#options' => $this
      ->getThemeOptions(),
    '#default_value' => $config['smartmenus_theme'] ? $config['smartmenus_theme'] : $this
      ->getDefaultTheme(),
    '#required' => true,
  );
  return $form;
}