You are here

function cache_actions_rules_action_info in Cache Actions 7.2

Same name and namespace in other branches
  1. 6.2 cache_actions.rules.inc \cache_actions_rules_action_info()
  2. 6 cache_actions.rules.inc \cache_actions_rules_action_info()
  3. 7 cache_actions.rules.inc \cache_actions_rules_action_info()

Implements hook_rules_action_info().

File

./cache_actions.rules.inc, line 11
This file provides the rules integration for this module.

Code

function cache_actions_rules_action_info() {

  // Actions that works for everyone.
  $actions = array(
    'cache_actions_action_clear_cache' => array(
      'label' => t('Clear cache bins'),
      'parameter' => array(
        'tables' => array(
          'type' => 'list<text>',
          'label' => t('Cache Bins'),
          'save' => TRUE,
          'options list' => 'cache_actions_get_cache_bins',
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_cache',
    ),
    'cache_actions_action_clear_cache_cid' => array(
      'label' => t('Clear a specific cache cid'),
      'parameter' => array(
        'bin' => array(
          'type' => 'text',
          'label' => t('Cache bin'),
          'description' => t('The cache table where the cid is'),
          'options list' => 'cache_actions_get_cache_bins',
          'restriction' => 'input',
          'save' => TRUE,
        ),
        'cid' => array(
          'type' => 'text',
          'label' => t('Cache key'),
          'description' => t('The key to clear'),
          'save' => TRUE,
        ),
        'wildcard' => array(
          'type' => 'boolean',
          'label' => t('Use wildcard'),
          'description' => t('Use wildcards. This means you will be clearing all cache keys that partially matches.'),
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_cache_cid',
    ),
    'cache_actions_action_clear_css_js_cache' => array(
      'label' => t('Clear the css and js cache'),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_css_js_cache',
    ),
  );

  // If the Views module is available, then we can clear the cache of
  // individual views.
  if (module_exists('views')) {
    $actions['cache_actions_action_clear_views_cache'] = array(
      'label' => t('Clear the cache for specific views'),
      'parameter' => array(
        'view' => array(
          'type' => 'list<text>',
          'label' => t('Views'),
          'description' => t('The cache of the selected views will be cleared.'),
          'options list' => '_cache_actions_get_views_list',
          'save' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_views_cache',
    );
    $actions['cache_actions_action_clear_views_display_cache'] = array(
      'label' => t('Clear the cache for views displays'),
      'parameter' => array(
        'displays' => array(
          'type' => 'list<text>',
          'label' => t('Displays'),
          'description' => t('The cache of the selected displays will be cleared'),
          'options list' => '_cache_actions_get_views_displays',
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_views_display_cache',
    );
  }

  // If the page manager module is available, then we can clear panels stuff.
  if (module_exists('page_manager')) {
    $actions['cache_actions_action_clear_panels_pane_cache'] = array(
      'label' => t('Clear the cache for panel page panes'),
      'parameter' => array(
        'panes' => array(
          'type' => 'list<text>',
          'label' => t('Panes'),
          'description' => t('Specify the panes to invalidate here.'),
          'options list' => '_cache_actions_get_panes',
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => '_cache_actions_clear_panels_cache',
    );
  }
  if (module_exists('panels_mini')) {
    $actions['cache_actions_action_clear_panels_mini_pane_cache'] = array(
      'label' => t('Clear the cache for mini panel panes'),
      'parameter' => array(
        'panes' => array(
          'type' => 'list<text>',
          'label' => t('Panel panes'),
          'options list' => '_cache_actions_get_mini_panel_panes',
          'description' => t('Specify the mini panel panes you want to invalidate.'),
          'save' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => '_cache_actions_clear_panels_cache',
    );
  }
  return $actions;
}