You are here

function admin_menu_theme_settings in Administration menu 7.3

Same name and namespace in other branches
  1. 5.3 admin_menu.inc \admin_menu_theme_settings()
  2. 5.2 admin_menu.module \admin_menu_theme_settings()
  3. 6.3 admin_menu.inc \admin_menu_theme_settings()
  4. 6 admin_menu.inc \admin_menu_theme_settings()

Form builder function for module settings.

1 string reference to 'admin_menu_theme_settings'
admin_menu_menu in ./admin_menu.module
Implements hook_menu().

File

./admin_menu.inc, line 613
Menu builder functions for Administration menu.

Code

function admin_menu_theme_settings() {
  $form['admin_menu_margin_top'] = array(
    '#type' => 'checkbox',
    '#title' => t('Adjust top margin'),
    '#default_value' => variable_get('admin_menu_margin_top', 1),
    '#description' => t('Shifts the site output down by approximately 20 pixels from the top of the viewport. If disabled, absolute- or fixed-positioned page elements may be covered by the administration menu.'),
  );
  $form['admin_menu_position_fixed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Keep menu at top of page'),
    '#default_value' => variable_get('admin_menu_position_fixed', 1),
    '#description' => t('Displays the administration menu always at the top of the browser viewport (even when scrolling the page).'),
  );

  // @todo Re-confirm this with latest browser versions.
  $form['admin_menu_position_fixed']['#description'] .= '<br /><strong>' . t('In some browsers, this setting may result in a malformed page, an invisible cursor, non-selectable elements in forms, or other issues.') . '</strong>';
  $form['advanced'] = array(
    '#type' => 'vertical_tabs',
    '#title' => t('Advanced settings'),
  );
  $form['plugins'] = array(
    '#type' => 'fieldset',
    '#title' => t('Plugins'),
    '#group' => 'advanced',
  );
  $form['plugins']['admin_menu_components'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enabled components'),
    '#options' => array(
      'admin_menu.icon' => t('Icon menu'),
      'admin_menu.menu' => t('Administration menu'),
      'admin_menu.search' => t('Search bar'),
      'admin_menu.users' => t('User counts'),
      'admin_menu.account' => t('Account links'),
    ),
  );
  $form['plugins']['admin_menu_components']['#default_value'] = array_keys(array_filter(variable_get('admin_menu_components', $form['plugins']['admin_menu_components']['#options'])));
  $process = element_info_property('checkboxes', '#process', array());
  $form['plugins']['admin_menu_components']['#process'] = array_merge(array(
    'admin_menu_settings_process_components',
  ), $process);
  $form['#attached']['js'][] = drupal_get_path('module', 'admin_menu') . '/admin_menu.admin.js';
  $form['tweaks'] = array(
    '#type' => 'fieldset',
    '#title' => t('System tweaks'),
    '#group' => 'advanced',
  );
  $form['tweaks']['admin_menu_tweak_modules'] = array(
    '#type' => 'checkbox',
    '#title' => t('Collapse module groups on the <a href="!modules-url">%modules</a> page', array(
      '%modules' => t('Modules'),
      '!modules-url' => url('admin/modules'),
    )),
    '#default_value' => variable_get('admin_menu_tweak_modules', 0),
  );
  if (module_exists('util')) {
    $form['tweaks']['admin_menu_tweak_modules']['#description'] = '<br /><strong>' . t('If the Utility module was installed for this purpose, it can be safely disabled and uninstalled.') . '</strong>';
  }
  $form['tweaks']['admin_menu_tweak_permissions'] = array(
    '#type' => 'checkbox',
    '#title' => t('Collapse module groups on the <a href="@permissions-url">%permissions</a> page', array(
      '%permissions' => t('Permissions'),
      '@permissions-url' => url('admin/people/permissions'),
    )),
    '#default_value' => variable_get('admin_menu_tweak_permissions', 0),
  );
  $form['tweaks']['admin_menu_tweak_tabs'] = array(
    '#type' => 'checkbox',
    '#title' => t('Move local tasks into menu'),
    '#default_value' => variable_get('admin_menu_tweak_tabs', 0),
    '#description' => t('Moves the tabs on all pages into the administration menu. Only possible for themes using the CSS classes <code>tabs primary</code> and <code>tabs secondary</code>.'),
  );
  $form['tweaks']['admin_menu_tweak_tabs_exclude_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Only move local tasks on frontend-pages'),
    '#description' => t('eg. because there, the tabs destroy your theme\'s layout. Do not move on admin-pages, since the standard admin-theme has room for them.'),
    '#default_value' => variable_get('admin_menu_tweak_tabs_exclude_admin', 0),
    '#prefix' => '<div style="margin-left:1.5em">',
    '#suffix' => '</div>',
    '#attributes' => array(
      'class' => array(
        'someclass',
      ),
    ),
    '#states' => array(
      'enabled' => array(
        ':checkbox[name="admin_menu_tweak_tabs"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['performance'] = array(
    '#type' => 'fieldset',
    '#title' => t('Performance'),
    '#group' => 'advanced',
  );
  $form['performance']['admin_menu_cache_client'] = array(
    '#type' => 'checkbox',
    '#title' => t('Cache menu in client-side browser'),
    '#default_value' => variable_get('admin_menu_cache_client', 1),
  );
  $form['performance']['admin_menu_issue_queues'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Issue Queue links in icon menu'),
    '#default_value' => variable_get('admin_menu_issue_queues', 1),
  );
  $form['accessibility'] = array(
    '#type' => 'fieldset',
    '#title' => t('Accessibility'),
    '#group' => 'advanced',
  );
  $form['accessibility']['admin_menu_font_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Font size'),
    '#description' => t('Font size in pixels (px), ems (em), or percentage (%).<br /> ie. <em>1.1em</em> or <em>16px</em> or <em>120%</em><br /> Leave this field blank to use the default font size.'),
    '#size' => 10,
    '#maxlength' => 5,
    '#default_value' => variable_get('admin_menu_font_size', ''),
  );
  $form['themes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Toolbar themes'),
    '#group' => 'advanced',
  );
  $form['themes']['admin_menu_theme'] = array(
    '#type' => 'radios',
    '#title' => t('Choose theme for your toolbar'),
    '#options' => array(
      'default' => t('Default theme'),
      'light' => t('Light theme'),
    ),
    '#default_value' => variable_get('admin_menu_theme', 'default'),
  );
  return system_settings_form($form);
}