You are here

function fastly_purge_form in Fastly 7

Same name and namespace in other branches
  1. 7.2 fastly.admin.inc \fastly_purge_form()

Purge form.

1 string reference to 'fastly_purge_form'
fastly_menu in ./fastly.module
Implements hook_menu().

File

./fastly.admin.inc, line 171
Administrative forms for Fastly module.

Code

function fastly_purge_form($form_state) {
  if (variable_get('fastly_service_id', '') && variable_get('fastly_api_key', '')) {
    $form['purge_url'] = array(
      '#type' => 'fieldset',
      '#title' => t('Purge by URL'),
      '#description' => t('Paste one or more URLs to purge. Each in new line.'),
    );
    $form['purge_url']['urls_list'] = array(
      '#type' => 'textarea',
    );
    $form['purge_url']['submit'] = array(
      '#type' => 'button',
      '#value' => t('Purge'),
      '#id' => 'urls',
      '#name' => 'urls',
      '#executes_submit_callback' => 1,
    );
    $form['purge_key'] = array(
      '#type' => 'fieldset',
      '#title' => t('Purge by key'),
      '#description' => t('Paste one or more keys to purge. Each in new line.'),
    );
    $form['purge_key']['keys_list'] = array(
      '#type' => 'textarea',
    );
    $form['purge_key']['submit'] = array(
      '#type' => 'button',
      '#value' => t('Purge'),
      '#id' => 'keys',
      '#name' => 'keys',
      '#executes_submit_callback' => 1,
    );
    $form['purge_all'] = array(
      '#type' => 'fieldset',
      '#title' => t('Purge all'),
      '#description' => t('Purge whole service. You might not use this function too often.'),
    );
    $form['purge_all']['submit'] = array(
      '#type' => 'button',
      '#value' => t('Purge'),
      '#id' => 'all',
      '#name' => 'all',
      '#executes_submit_callback' => 1,
    );
    return $form;
  }
  else {
    drupal_set_message(t('You need to set up your API key and service ID to use this form.'), 'warning');
  }
}