function mobile_navigation_configuration_form in Mobile Navigation 7.2
Same name and namespace in other branches
- 8 mobile_navigation.admin.inc \mobile_navigation_configuration_form()
- 7 mobile_navigation.admin.inc \mobile_navigation_configuration_form()
Mobile navigation admin form definition.
1 string reference to 'mobile_navigation_configuration_form'
- mobile_navigation_menu in ./
mobile_navigation.module - Implements hook_menu().
File
- ./
mobile_navigation.admin.inc, line 13 - Mobile Navigation Administration page.
Code
function mobile_navigation_configuration_form($form, &$form_state) {
module_load_include('inc', 'mobile_navigation', 'mobile_navigation');
drupal_add_js(drupal_get_path('module', 'mobile_navigation') . '/mobile_navigation.admin.js', array(
'preprocess' => FALSE,
));
$menu_id = arg(4);
$menu = menu_load($menu_id);
$display = arg(7);
drupal_set_title(t('Configuration for @menu on @display display.', array(
'@menu' => $menu['title'],
'@display' => $display,
)));
$did = db_query('SELECT id FROM {mobile_navigation_displays} WHERE name = :display', array(
':display' => $display,
))
->fetchField();
$conf = db_query('SELECT * FROM {mobile_navigation_configurations} WHERE menu = :menu AND display = :display', array(
':menu' => $menu_id,
':display' => $did,
))
->fetchAssoc();
$form['markup'] = array(
'#markup' => t('Welcome to this Mobile Navigation configuration page.<br />' . 'This settings are aplied to <strong>@menu</strong> on the <strong>@display</strong> display.<br />' . 'Add this class <strong>@class</strong> to any element in the page, to make it a clickable trigger for showing/hiding this menu.' . '.', array(
'@menu' => $menu['title'],
'@display' => $display,
'@class' => arg(4) . '_' . $display . '-trigger',
)),
);
$form['mobile_navigation_menu_selector'] = array(
'#type' => 'textfield',
'#title' => t('Hide this selection'),
'#description' => t('JQuery selector for original menu or anything that you need to hide when this display configuration is anabled.</br>' . 'Remember JQuery allows for multiple coma separated selectors.'),
'#size' => 40,
'#maxlength' => 128,
'#default_value' => $conf['menu_selector'],
);
$form['mobile_navigation_navigation_plugin'] = array(
'#title' => 'Navigation Plugin',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#description' => t('Mobile navigation plugin for the menu navigation.'),
);
$form['mobile_navigation_navigation_plugin']['mobile_navigation_plugin'] = array(
'#type' => 'radios',
'#title' => t('Plugin'),
'#default_value' => $conf['plugin'],
'#options' => mobile_navigation_get_plugins(),
'#description' => t('Type of mobile navigation plugin.'),
);
/********** Accordion behaviours fieldset ********/
$form['mobile_navigation_navigation_plugin']['mobile_navigation_accordion_behaviors'] = array(
'#title' => 'Only Accordion Behaviors',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#description' => t('Only accordion plugin behaviors.'),
);
/*** end of accordion behaviors ***/
$form['mobile_navigation_navigation_plugin']['mobile_navigation_accordion_behaviors']['mobile_navigation_expand_only_active_trail'] = array(
'#title' => t('Expand only active trail'),
'#type' => 'checkbox',
'#description' => t('When the user expands an item that has sub-items, they can presistently stay oppened or it can be that any item that is not in the current active trail will automaticaly close.'),
'#default_value' => $conf['expand_only_active_trail'],
);
$form['mobile_navigation_show_hide_effect'] = array(
'#title' => 'Mobile Navigation Show\'n Hide Effect',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
);
$form['mobile_navigation_show_hide_effect']['mobile_navigation_show_hide_effect'] = array(
'#type' => 'radios',
'#title' => t('Menu Effect'),
'#default_value' => $conf['show_hide_effect'],
'#options' => mobile_navigation_get_effects(),
'#description' => t('Choose an Effect to use for the mobile menu.'),
);
$form['mobile_navigation_settings'] = array(
'#title' => 'Mobile Navigation Settings',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#description' => t('General settings for visual aspects and behavior of the menu.'),
);
$form['mobile_navigation_settings']['mobile_navigation_menu_width'] = array(
'#type' => 'textfield',
'#title' => t('Menu Width (%)'),
'#description' => t('Width of the mobile menu. (%)'),
'#size' => 5,
'#maxlength' => 5,
'#required' => TRUE,
'#default_value' => $conf['menu_width'],
);
$form['mobile_navigation_settings']['mobile_navigation_collapse_by_default'] = array(
'#title' => t('Collapsed by default'),
'#type' => 'checkbox',
'#description' => t('Have the menu collapsed when initialized.'),
'#default_value' => $conf['collapse_by_default'],
);
$form['mobile_navigation_settings']['mobile_navigation_use_button'] = array(
'#title' => t("Use a button on a block to show and hide the menu."),
'#type' => 'checkbox',
'#default_value' => $conf['use_button'],
);
$form['mobile_navigation_settings']['mobile_navigation_button_title_fieldset'] = array(
'#title' => 'Button Title',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#description' => t('A block will be generated.<br /> Don\'t forget to go to Admin > Structure > Blocks to place it on a page region.'),
);
$form['mobile_navigation_settings']['mobile_navigation_button_title_fieldset']['mobile_navigation_button_title'] = array(
'#type' => 'textfield',
'#title' => t('Title on Tab Handler'),
'#description' => t('Title to show on the button.'),
'#size' => 40,
'#maxlength' => 128,
'#default_value' => $conf['button_title'],
'#field_suffix' => t("<a id='button-title-three-bars' href='#'>Append ☰ character.</a>"),
);
$form['mobile_navigation_settings']['mobile_navigation_use_handler'] = array(
'#title' => t("Use tab handler on menu. A label atached to the menu, that shows/hides menu on click."),
'#type' => 'checkbox',
'#default_value' => $conf['use_handler'],
);
$form['mobile_navigation_settings']['mobile_navigation_handler_title_fieldset'] = array(
'#title' => 'Handler Title',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#type' => 'fieldset',
'#description' => t('Title to show on Tab handler.'),
);
$form['mobile_navigation_settings']['mobile_navigation_handler_title_fieldset']['mobile_navigation_handler_title'] = array(
'#type' => 'textfield',
'#title' => '',
'#description' => t('Title to show on the tab handler.'),
'#size' => 40,
'#maxlength' => 127,
'#default_value' => $conf['handler_title'],
'#field_suffix' => t("<a id='handler-title-three-bars' href='#'>Append ☰ character.</a>"),
);
$form['mobile_navigation_settings']['mobile_navigation_use_mask'] = array(
'#title' => t('Use mask over contents when mobile menu is openned'),
'#type' => 'checkbox',
'#description' => t('Block the page contents when the menu gets openned and place a clickable mask over to close the menu when it is clicked.'),
'#default_value' => $conf['use_mask'],
);
$form['mobile_navigation_settings']['mobile_navigation_use_classes'] = array(
'#title' => t('Add Special classes to mobile menu'),
'#type' => 'checkbox',
'#description' => t('Special Classes are added to Menu Items according to their position and level. (Like for instance: Item-1, Item-2-1, Item-3-1-1, etc.)'),
'#default_value' => $conf['use_classes'],
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit Changes'),
);
return $form;
}