You are here

function facetapi_revert_form in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 facetapi.admin.inc \facetapi_revert_form()
  2. 7 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 1232
Admin page callbacks for the Facet API module.

Code

function facetapi_revert_form(&$form_state, FacetapiAdapter $adapter, array $realm, array $facet) {
  $form = array();
  $form['#facetapi'] = array(
    'adapter' => $adapter,
    'realm' => $realm,
    'facet' => $facet,
  );
  $form['text'] = array(
    '#value' => '<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(
    '#weight' => 20,
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Revert configuration'),
  );
  $form['actions']['cancel'] = array(
    '#value' => l(t('Cancel'), $adapter
      ->getPath($realm['name']), array(
      'attributes' => array(
        'title' => t('Do not revert configurations'),
      ),
    )),
  );
  $form['#submit'][] = 'facetapi_revert_form_submit';
  return $form;
}