function menu_target_menu_configure_extra_elements in Menu target 8
Same name and namespace in other branches
- 7 menu_target.admin.inc \menu_target_menu_configure_extra_elements()
Implements hook_form_FORM_ID_alter().
1 call to menu_target_menu_configure_extra_elements()
- menu_target_form_menu_configure_alter in ./
menu_target.module - Implements hook_form_FORM_ID_alter().
File
- ./
menu_target.admin.inc, line 121 - Allows content editors to choose wether or not to open menu items in a new window
Code
function menu_target_menu_configure_extra_elements(&$form) {
$config = Drupal::config('menu_target.settings');
$form['menu_target'] = array(
'#type' => 'fieldset',
'#title' => t('Menu target'),
);
$form['menu_target']['menu_target_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Menu target enabled'),
'#default_value' => $config
->get('enabled'),
);
$form['menu_target']['menu_target_settings'] = array(
'#type' => 'container',
'#states' => array(
'invisible' => array(
'input[name="menu_target_enabled"]' => array(
'checked' => FALSE,
),
),
),
);
$form['menu_target']['menu_target_settings']['menu_target_type'] = array(
'#type' => 'radios',
'#title' => t('Type'),
'#options' => array(
'html' => t('Degradable'),
'javascript' => t('XHTML Valid'),
),
'#default_value' => $config
->get('type'),
'#description' => t("Here you can choose which behavior is used to open links in new windows. If you choose 'Degradable', the HTML !link1 attribute will be used. While this attribute does not validate for XHTML doctypes since version 1.1, you can also choose to use the 'XHTML valid' option. This will use JavaScript to open links in a new window", array(
'!link1' => l(t('target'), 'http://www.w3.org/TR/html4/present/frames.html#adef-target'),
)),
);
$form['#submit'][] = 'menu_target_menu_configure_extra_elements_submit';
}