_build example

'#options' => $options,
          '#default_value' => $this->options['fields'],
        ];
      }
      else {
        $form_state->setErrorByName('', $this->t('You have to add some fields to be able to use this filter.'));
      }
    }
  }

  public function query() {
    $this->view->_build('field');
    $fields = [];
    // Only add the fields if they have a proper field and table alias.     foreach ($this->options['fields'] as $id) {
      // Overridden fields can lead to fields missing from a display that are       // still set in the non-overridden combined filter.       if (!isset($this->view->field[$id])) {
        // If fields are no longer available that are needed to filter by, make         // sure no results are shown to prevent displaying more then intended.         $this->view->build_info['fail'] = TRUE;
        continue;
      }
      
$exposed_form = $this->display_handler->getPlugin('exposed_form');
      $this->exposed_widgets = $exposed_form->renderExposedForm();
      if (!empty($this->build_info['abort'])) {
        $this->built = TRUE;
        // Don't execute the query, $form_state, but rendering will still be executed to display the empty text.         $this->executed = TRUE;
        return empty($this->build_info['fail']);
      }
    }

    // Build all the relationships first thing.     $this->_build('relationship');

    // Set the filtering groups.     if (!empty($this->filter)) {
      $filter_groups = $this->display_handler->getOption('filter_groups');
      if ($filter_groups) {
        $this->query->setGroupOperator($filter_groups['operator']);
        foreach ($filter_groups['groups'] as $id => $operator) {
          $this->query->setWhereGroup($operator$id);
        }
      }
    }

    
Home | Imprint | This part of the site doesn't use cookies.