function acquia_purge_manualpurge_form in Acquia Purge 6
Menu callback to drupal_get_form; let users manually purge pages.
@returns A standard Form API form-array.
1 string reference to 'acquia_purge_manualpurge_form'
- acquia_purge_menu in ./
acquia_purge.module - Implements hook_menu().
File
- ./
acquia_purge.admin.inc, line 71 - Admin page callbacks and theme functions for the Acquia Purge module.
Code
function acquia_purge_manualpurge_form(&$form_state) {
$fields_amount = 7;
$schemes = _acquia_purge_get_protocol_schemes();
$domains = _acquia_purge_get_domains();
$form['description'] = array(
'#type' => 'item',
'#value' => t('<p>This form allows you to purge one or more paths from your
Acquia Cloud load balancers, e.g.: <b><front> ?page=1</b>. This
functionality is not intended for day-to-day use but rather for emergency
cases when an outdated copy of a page is served. It is highly recommended to
automate your site by creating rules for these paths, so everybody editing
content can rely on your site refreshing properly.</p>'),
);
$form['domains'] = array(
'#type' => 'item',
'#value' => '<p>' . theme('item_list', $domains, t('Paths will be purged on:')) . '</p>',
);
// We'll group all paths both in a HTML wrapper and logically in the form.
$form['#tree'] = TRUE;
$form['paths'] = array(
'#prefix' => '<p><h3>' . t('Paths to be purged:') . '</h3><ul>',
'#suffix' => '</ul></p>',
);
// Fill paths with the right amount of form items according to fields_amount.
$prefix = sprintf('<b>%s://%s%s</b>', $schemes[0], $domains[0], base_path());
for ($i = 0; $i < $fields_amount; $i++) {
$form['paths']['path'][$i] = array(
'#type' => 'textfield',
'#field_prefix' => $prefix,
'#size' => 30,
'#prefix' => '<li>',
'#suffix' => '</li>',
);
}
// Render the submit button and return the form.
$form['submit'] = array(
'#type' => 'submit',
'#value' => t("I know the risks, purge!"),
);
return $form;
}