You are here

function _acquia_purge_manualpurge_base in Acquia Purge 7

A (base)form that lets users purge manually.

3 calls to _acquia_purge_manualpurge_base()
acquia_purge_manualpurge_form_full in ./acquia_purge.admin.inc
UX rich form that lets administrative users purge paths manually.
acquia_purge_manualpurge_form_page in ./acquia_purge.admin.inc
Single button form that lets administrative users purge the current page.
acquia_purge_manualpurge_form_paths in ./acquia_purge.admin.inc
Bare bones form that lets administrative users purge paths manually.

File

./acquia_purge.admin.inc, line 223
Admin page callbacks and theme functions for the Acquia Purge module.

Code

function _acquia_purge_manualpurge_base(&$form, &$form_state) {
  $form['#tree'] = TRUE;
  $form['paths'] = array(
    '#prefix' => '<div id="paths-wrapper">',
    '#suffix' => '</div>',
    '#weight' => 5,
  );

  // Generate the path textfields, add and remove buttons.
  if (empty($form_state['num_paths'])) {
    $form_state['num_paths'] = 1;
  }
  for ($i = 0; $i < $form_state['num_paths']; $i++) {
    $form['paths']['path'][$i] = array(
      '#type' => 'textfield',
      '#autocomplete_path' => 'acquia_purge_ajax_autocomplete',
    );
  }
  $form['paths']['add_path'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
    '#submit' => array(
      '_acquia_purge_manualpurge_add',
    ),
    '#ajax' => array(
      'callback' => '_acquia_purge_manualpurge_paths',
      'wrapper' => 'paths-wrapper',
    ),
  );
  if ($form_state['num_paths'] > 1) {
    $form['paths']['remove_path'] = array(
      '#type' => 'submit',
      '#value' => t('Remove last item'),
      '#submit' => array(
        '_acquia_purge_manualpurge_remove',
      ),
      '#limit_validation_errors' => array(),
      '#ajax' => array(
        'callback' => '_acquia_purge_manualpurge_paths',
        'wrapper' => 'paths-wrapper',
      ),
    );
  }

  // Render the submit button and return the form.
  $form['submits'] = array(
    '#weight' => 10,
  );
  $form['submits']['paths'] = array(
    '#type' => 'submit',
    '#prefix' => '<p>',
    '#suffix' => '</p>',
    '#value' => _acquia_purge_variable('acquia_purge_cron') ? t("Queue") : t("Refresh"),
  );
  $form['submits']['page'] = array(
    '#type' => 'submit',
    '#value' => t("Refresh this page"),
  );
  return $form;
}