public function MobileDeviceDetectionExtenderPlugin::buildOptionsForm in Mobile Device Detection 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/views/display_extender/MobileDeviceDetectionExtenderPlugin.php \Drupal\mobile_device_detection\Plugin\views\display_extender\MobileDeviceDetectionExtenderPlugin::buildOptionsForm()
- 8 src/Plugin/views/display_extender/MobileDeviceDetectionExtenderPlugin.php \Drupal\mobile_device_detection\Plugin\views\display_extender\MobileDeviceDetectionExtenderPlugin::buildOptionsForm()
Provide a form to edit options for this plugin.
Overrides DisplayExtenderPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ display_extender/ MobileDeviceDetectionExtenderPlugin.php, line 53
Class
- MobileDeviceDetectionExtenderPlugin
- Default display extender plugin; does nothing.
Namespace
Drupal\mobile_device_detection\Plugin\views\display_extenderCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if ($form_state
->get('section') == 'device_detection') {
$form['#title'] .= $this
->t('Show "View" on special devices');
$form['device_detection']['#type'] = 'container';
$form['device_detection']['#tree'] = TRUE;
$form['device_detection']['devices'] = [
'#type' => 'checkboxes',
'#options' => [
'mobile' => $this
->t('Mobile'),
'tablet' => $this
->t('Tablet'),
'desktop' => $this
->t('Desktop'),
],
'#default_value' => $this
->getDevices() ? $this
->getDevices() : [],
'#title' => $this
->t('Select device'),
];
}
}