Exemplo n.º 1
0
Arquivo: Block.php Projeto: Wylbur/gj
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = $form['allow']['#options'];
     $options['offset'] = $this->t('Pager offset');
     $options['pager'] = $this->t('Pager type');
     $options['hide_fields'] = $this->t('Hide fields');
     $options['sort_fields'] = $this->t('Reorder fields');
     $options['disable_filters'] = $this->t('Disable filters');
     $options['configure_sorts'] = $this->t('Configure sorts');
     $form['allow']['#options'] = $options;
     // Update the items_per_page if set.
     $defaults = array_filter($form['allow']['#default_value']);
     if (isset($defaults['items_per_page'])) {
         $defaults['items_per_page'] = 'items_per_page';
     }
     $form['allow']['#default_value'] = $defaults;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     if (!$this->getSearchIndexId()) {
         return;
     }
     switch ($form_state->get('section')) {
         case 'linked_path':
             $form['#title'] .= $this->t('Search page path');
             $form['linked_path'] = array('#type' => 'textfield', '#description' => $this->t('The menu path to which search facets will link. Leave empty to use the current path.'), '#default_value' => $this->getOption('linked_path'));
             break;
         case 'facet_field':
             $form['facet_field'] = array('#type' => 'select', '#title' => $this->t('Facet field'), '#options' => $this->getFieldOptions(), '#default_value' => $this->getOption('facet_field'));
             break;
         case 'use_more':
             $form['use_more']['#description'] = $this->t('This will add a more link to the bottom of this view, which will link to the base path for the facet links.');
             $form['use_more_always'] = array('#type' => 'value', '#value' => $this->getOption('use_more_always'));
             break;
         case 'hide_block':
             $form['hide_block'] = array('#type' => 'checkbox', '#title' => $this->t('Hide block'), '#description' => $this->t('Hide this block, but still execute the search. Can be used to show native Facet API facet blocks linking to the search page specified above.'), '#default_value' => $this->getOption('hide_block'));
             break;
     }
 }