You are here

function admin_menu_admin_settings_form in Administration menu 8.3

Form builder function for module settings.

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

File

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

Code

function admin_menu_admin_settings_form($form, &$form_state) {
  $form['admin_menu_margin_top'] = [
    '#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'] = [
    '#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'] = [
    '#type' => 'vertical_tabs',
    '#title' => t('Advanced settings'),
  ];
  $form['plugins'] = [
    '#type' => 'details',
    '#title' => t('Plugins'),
    '#group' => 'advanced',
  ];
  $form['plugins']['admin_menu_components'] = [
    '#type' => 'checkboxes',
    '#title' => t('Enabled components'),
    '#options' => [
      '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', []);
  $form['plugins']['admin_menu_components']['#process'] = array_merge([
    'admin_menu_settings_process_components',
  ], $process);
  $form['#attached']['js'][] = drupal_get_path('module', 'admin_menu') . '/admin_menu.admin.js';
  $form['tweaks'] = [
    '#type' => 'details',
    '#title' => t('System tweaks'),
    '#group' => 'advanced',
  ];
  $form['tweaks']['admin_menu_tweak_modules'] = [
    '#type' => 'checkbox',
    '#title' => t('Collapse module groups on the <a href="!modules-url">%modules</a> page', [
      '%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'] = [
    '#type' => 'checkbox',
    '#title' => t('Collapse module groups on the <a href="@permissions-url">%permissions</a> page', [
      '%permissions' => t('Permissions'),
      '@permissions-url' => url('admin/people/permissions'),
    ]),
    '#default_value' => variable_get('admin_menu_tweak_permissions', 0),
  ];
  $form['tweaks']['admin_menu_tweak_tabs'] = [
    '#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['performance'] = [
    '#type' => 'details',
    '#title' => t('Performance'),
    '#group' => 'advanced',
  ];
  $form['performance']['admin_menu_cache_client'] = [
    '#type' => 'checkbox',
    '#title' => t('Cache menu in client-side browser'),
    '#default_value' => variable_get('admin_menu_cache_client', 1),
  ];
  return system_settings_form($form);
}