+ if (empty($form_state['facet_names'])) {
+ $form_state['facet_names'] = array('source', 'author', 'subject');
+ }
+ foreach ($form_state['facet_names'] as $facet) {
+ $form['settings']['facets'][$facet] = array(
+ '#type' => 'fieldset',
+ '#title' => $facet . ' ' . t('facet'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE
+ );
+ $form['settings']['facets'][$facet]['displayName'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Facet name to display in UI'),
+ '#required' => TRUE,
+ '#default_value' => $settings['facets'][$facet]['displayName'],
+ );
+ $form['settings']['facets'][$facet]['pz2Name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Name of termlist in Pazpar2'),
+ '#required' => TRUE,
+ '#default_value' => $settings['facets'][$facet]['pz2Name'],
+ );
+ $form['settings']['facets'][$facet]['limiter'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Query limiter string'),
+ '#default_value' => $settings['facets'][$facet]['limiter'],
+ '#size' => 5,
+ );
+ $form['settings']['facets'][$facet]['max'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Number of terms to display'),
+ '#required' => TRUE,
+ '#default_value' => $settings['facets'][$facet]['max'],
+ '#size' => 3,
+ '#maxlength' => 3,
+ );
+ $form['settings']['facets'][$facet]['orderWeight'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Facet weight'),
+ '#default_value' => $settings['facets'][$facet]['orderWeight'],
+ '#size' => 3,
+ '#maxlength' => 3,
+ );
+ }
+ $form['new_facet'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Add new facet...'),
+ '#tree' => TRUE,
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE