You are here

function cacheflush_menu in CacheFlush 7

Same name and namespace in other branches
  1. 7.3 cacheflush.module \cacheflush_menu()
  2. 7.2 cacheflush.module \cacheflush_menu()

Implements hook_menu().

File

./cacheflush.module, line 11
Cacheflush module.

Code

function cacheflush_menu() {
  $items['admin/config/development/cacheflush'] = array(
    'title' => 'Cache Flush',
    'type' => MENU_NORMAL_ITEM,
    'description' => 'Create dynamically cache presets.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'cacheflush_list_preset_form',
    ),
    'access arguments' => array(
      'cacheflush development',
    ),
    'file' => 'cacheflush.admin.inc',
  );
  $items['admin/config/development/cacheflush/preset'] = array(
    'title' => 'Create new preset',
    'type' => MENU_LOCAL_ACTION,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'cacheflush_preset_form',
      5,
    ),
    'access arguments' => array(
      'cacheflush development add',
    ),
    'weight' => 1,
    'file' => 'cacheflush.preset.inc',
  );
  $items['admin/config/development/cacheflush/preset/delete/%'] = array(
    'title' => 'Delete preset',
    'type' => MENU_NORMAL_ITEM,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'cacheflush_delete_preset_form',
      6,
    ),
    'access arguments' => array(
      'cacheflush development delete',
    ),
    'file' => 'cacheflush.preset.inc',
  );

  /**************** Preset's *****************/
  $items['admin/cacheflush'] = array(
    'title' => 'Cache Flush',
    'type' => MENU_NORMAL_ITEM,
    'description' => 'List cache clear presets',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'cacheflush preset',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items["admin/cacheflush/clearall"] = array(
    'title' => 'Clear All',
    'description' => 'Clear all cache.',
    'page callback' => '_cacheflush_clear_all',
    'weight' => -50,
    'access arguments' => array(
      'cacheflush preset clearall',
    ),
    'file' => 'cacheflush.inc',
  );
  $cache_presets = variable_get('cacheflush_preset_list', array());
  if ($cache_presets) {
    foreach ($cache_presets as $key => $value) {
      if ($value['#enabled'] > 0) {
        $items["admin/cacheflush/clear/preset/{$key}"] = array(
          'title' => $value['#name'],
          'description' => "Clear " . $value['#name'] . " cache.",
          'page callback' => '_cacheflush_clear_preset',
          'page arguments' => array(
            4,
          ),
          'weight' => $key,
          'access arguments' => array(
            "cacheflush preset {$key}",
          ),
          'file' => 'cacheflush.inc',
        );
      }
    }
  }
  return $items;
}