You are here

function facetapi_export_form in Facet API 7

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

Form constructor for the export form.

Parameters

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

array $realm: The realm definition.

array $facet: The facet definition.

See also

ctools_export_form()

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

File

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

Code

function facetapi_export_form($form, &$form_state, FacetapiAdapter $adapter, array $realm, array $facet) {
  $form['facet'] = array();
  $form['global'] = array();

  // Adds link to get back to list page.
  $form['back'] = array(
    '#type' => 'link',
    '#title' => t('Go back to realm settings page'),
    '#href' => $adapter
      ->getPath($realm['name']),
  );

  // Gets export fieldset for display settings.
  $title = t('Display settings');
  $settings = $adapter
    ->getFacetSettings($facet, $realm);
  $export = ctools_export_crud_export('facetapi', $settings);
  $form['facet'] = ctools_export_form($form['facet'], $form_state, $export, $title);

  // Gets export fieldset for display settings.
  $title = t('Global settings');
  $settings = $adapter
    ->getFacetSettingsGlobal($facet);
  $export = ctools_export_crud_export('facetapi', $settings);
  $form['global'] = ctools_export_form($form['global'], $form_state, $export, $title);

  // Adds settings and returns form.
  $form['#settings'] = $settings;
  return $form;
}