usesGrouping example



  /** * {@inheritdoc} */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form$form_state);
    // Only fields-based views can handle grouping. Style plugins can also exclude     // themselves from being groupable by setting their "usesGrouping" property     // to FALSE.     // @TODO: Document "usesGrouping" in docs.php when docs.php is written.     if ($this->usesFields() && $this->usesGrouping()) {
      $options = ['' => $this->t('- None -')];
      $field_labels = $this->displayHandler->getFieldLabels(TRUE);
      $options += $field_labels;
      // If there are no fields, we can't group on them.       if (count($options) > 1) {
        // This is for backward compatibility, when there was just a single         // select form.         if (is_string($this->options['grouping'])) {
          $grouping = $this->options['grouping'];
          $this->options['grouping'] = [];
          $this->options['grouping'][0]['field'] = $grouping;
        }
Home | Imprint | This part of the site doesn't use cookies.