You are here

coffee.admin.inc in Coffee 7.2

Admin page callbacks for the coffee module.

File

coffee.admin.inc
View source
<?php

/**
 * @file
 * Admin page callbacks for the coffee module.
 */

/**
 * Form builder; Configure coffee settings.
 *
 * @ingroup forms
 * @see system_settings_form()
 */
function coffee_admin_settings() {
  $form = array();
  $form['help'] = array(
    '#markup' => '<label>Toggle Coffee</label><p>Toggle Coffee using the keyboard shortcut alt + D (alt + shift + D in Opera, alt + ctrl + D in Windows Internet Explorer). You can also use use the alternative alt + k.</p>',
  );

  // Output the checkboxes to let admins select which menus are
  // featured in coffee.
  $menus = menu_get_menus();
  $menu_options = array();
  foreach ($menus as $name => $title) {
    $menu_options[$name] = check_plain($title);
  }
  if (!empty($menu_options)) {
    $form['coffee_settings_menus'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Menus to include in Coffee'),
      '#options' => $menu_options,
      '#default_value' => variable_get('coffee_settings_menus', array(
        'management',
        'user-menu',
      )),
      '#description' => 'Select the menus to include in Coffee, changes will be active after a cache clear.',
    );
  }
  $form['#submit'][0] = 'coffee_admin_settings_submit';
  return system_settings_form($form);
}

/**
 * Function coffee_admin_settings_submit().
 */
function coffee_admin_settings_submit($form, $form_state) {

  // As we're altering which menus are being included in
  // coffee, rebuild the cached commands for users so they
  // get these changes.
  cache_clear_all(NULL, 'cache_coffee');
}

Functions

Namesort descending Description
coffee_admin_settings Form builder; Configure coffee settings.
coffee_admin_settings_submit Function coffee_admin_settings_submit().