You are here

function authcache_admin_pagecaching in Authenticated User Page Caching (Authcache) 7.2

Same name and namespace in other branches
  1. 6 authcache.admin.inc \authcache_admin_pagecaching()
  2. 7 authcache.admin.inc \authcache_admin_pagecaching()

Page caching rules form.

1 string reference to 'authcache_admin_pagecaching'
authcache_menu in ./authcache.module
Implements hook_menu().

File

./authcache.admin.inc, line 208
Admin forms and pages.

Code

function authcache_admin_pagecaching($form, &$form_state) {
  drupal_set_title(t('Authcache Page Caching Settings'));
  if (!count(authcache_get_roles())) {
    drupal_set_message(t('You must first select roles to cache before defining page caching setting.'), 'error');
    return $form;
  }
  $form['ajax_wrapper'] = array(
    '#tree' => FALSE,
    '#prefix' => '<div class="clear-block" id="ajax-wrapper">',
    '#suffix' => '</div>',
  );
  if (empty($form_state['rules'])) {
    $form_state['rules'] = variable_get('authcache_pagecaching', _authcache_default_pagecaching());
  }
  $form['ajax_wrapper']['ajax']['#tree'] = TRUE;
  $count = count($form_state['rules']);
  foreach ($form_state['rules'] as $delta => $detail) {
    $form['ajax_wrapper']['ajax'][$delta] = _authcache_pagecache_form($delta, $detail, $count);
  }
  $form['ajax_wrapper']['add_rule'] = array(
    '#type' => 'submit',
    '#value' => t('Add ruleset'),
    '#submit' => array(
      'authcache_admin_pagecaching_add_one',
    ),
    '#ajax' => array(
      'callback' => 'authcache_admin_pagecaching_ajax_callback',
      'wrapper' => 'ajax-wrapper',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save & clear cached pages'),
    '#prefix' => '<br/><hr size="1"><br/>',
  );
  return $form;
}