You are here

public function FacetapiDependencyBundle::settingsForm in Facet API 7

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/dependency_bundle.inc \FacetapiDependencyBundle::settingsForm()
  2. 7.2 plugins/facetapi/dependency_bundle.inc \FacetapiDependencyBundle::settingsForm()

Overrides FacetapiDependency::settingsForm().

Overrides FacetapiDependency::settingsForm

File

plugins/facetapi/dependency_bundle.inc, line 95
The bundle dependency class.

Class

FacetapiDependencyBundle
Dependency plugin adding bundle conditions.

Code

public function settingsForm(&$form, &$form_state) {

  // Builds array of options.
  $options = array();
  $options['none'] = t('No dependencies.');
  if ($this->facet['field api name']) {
    $options['referenced'] = t('A bundle this field is attached to must be active.');
  }
  $options['selected'] = t('At least one of the selected bundles must be active.');
  $form[$this->id]['bundle'] = array(
    '#title' => t('Dependency settings'),
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => $this->settings['bundle'],
  );
  $form[$this->id]['bundle_selected'] = array(
    '#title' => t('Required bundles'),
    '#type' => 'checkboxes',
    '#options' => $this
      ->getBundleOptions($form['#facetapi']['adapter']
      ->getTypes()),
    '#default_value' => $this->settings['bundle_selected'],
    '#states' => array(
      'visible' => array(
        'input[name="bundle"]' => array(
          'value' => 'selected',
        ),
      ),
    ),
    '#description' => t('At least one of the selected bundles must be active for this facet to be rendered.'),
  );
}