public function ResponsiveMenusSimple::settingsForm in Responsive Menus 8
Form constructor.
Parameters
array $form: An associative array containing the initial structure of the plugin form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.
Return value
array The form structure.
Overrides ResponsiveMenusPluginBase::settingsForm
File
- src/
Plugin/ ResponsiveMenus/ ResponsiveMenusSimple.php, line 49
Class
- ResponsiveMenusSimple
- Defines the "responsive_menus_simple" plugin.
Namespace
Drupal\responsive_menus\Plugin\ResponsiveMenusCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['responsive_menus_simple_absolute'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Use absolute positioning?'),
'#default_value' => $this
->getSetting('responsive_menus_simple_absolute'),
'#description' => $this
->t('Using absolute, the menu will open over the page rather than pushing it down.'),
];
$form['responsive_menus_disable_mouse_events'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Disable other mouse events?'),
'#default_value' => $this
->getSetting('responsive_menus_disable_mouse_events'),
'#description' => $this
->t('Disable things like drop-down menus on hover.'),
];
$form['responsive_menus_remove_attributes'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Remove other classes & IDs when responded?'),
'#default_value' => $this
->getSetting('responsive_menus_remove_attributes'),
'#description' => $this
->t('Helps to ensure styling of menu.'),
];
$form['responsive_menus_css_selectors'] = [
'#type' => 'textarea',
'#title' => $this
->t('Selectors for which menus to responsify'),
'#default_value' => $this
->getSetting('responsive_menus_css_selectors'),
'#description' => $this
->t('Enter CSS/jQuery selectors of menus to responsify. Comma separated or 1 per line'),
];
$form['responsive_menus_simple_text'] = [
'#type' => 'textarea',
'#title' => $this
->t('Text or HTML for the menu toggle button'),
'#default_value' => $this
->getSetting('responsive_menus_simple_text'),
];
$form['responsive_menus_media_size'] = [
'#type' => 'number',
'#title' => $this
->t('Screen width to respond to'),
'#size' => 5,
'#default_value' => $this
->getSetting('responsive_menus_media_size'),
'#description' => $this
->t('Width when we swap out responsive menu e.g. 768'),
];
$form['responsive_menus_media_unit'] = [
'#type' => 'select',
'#title' => $this
->t('Width unit'),
'#default_value' => $this
->getSetting('responsive_menus_media_unit'),
'#options' => [
'px' => 'px',
'em' => 'em',
],
'#description' => $this
->t('Unit for the width above'),
];
return $form;
}