You are here

function facetapi_revert_form in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.admin.inc \facetapi_revert_form()
  2. 7.2 facetapi.admin.inc \facetapi_revert_form()

Form constructor for the revert form.

Parameters

FacetapiAdapter $adapter: The adapter object the settings apply to.

array $realm: The realm definition.

array $facet: The facet definition.

1 string reference to 'facetapi_revert_form'
facetapi_menu in ./facetapi.module
Implements hook_menu().

File

./facetapi.admin.inc, line 1307
Admin page callbacks for the Facet API module.

Code

function facetapi_revert_form($form, &$form_state, FacetapiAdapter $adapter, array $realm, array $facet) {
  $form['#facetapi'] = array(
    'adapter' => $adapter,
    'realm' => $realm,
    'facet' => $facet,
  );
  $form['text'] = array(
    '#markup' => '<p>' . t('Any changes you have made will be lost and cannot be recovered.') . '</p>',
  );
  $form['revert_facet'] = array(
    '#type' => 'checkbox',
    '#access' => facetapi_is_overridden($adapter
      ->getFacetSettings($facet, $realm)),
    '#title' => t('Revert per-facet display configuration settings.'),
    '#default_value' => TRUE,
  );
  $form['revert_global'] = array(
    '#type' => 'checkbox',
    '#access' => facetapi_is_overridden($adapter
      ->getFacetSettingsGlobal($facet)),
    '#title' => t('Revert global configuration settings.'),
    '#default_value' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
    '#weight' => 20,
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Revert configuration'),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'link',
    '#title' => t('Cancel'),
    '#href' => $adapter
      ->getPath($realm['name']),
    '#attributes' => array(
      'title' => t('Do not revert configurations'),
    ),
  );
  $form['#submit'][] = 'facetapi_revert_form_submit';
  return $form;
}