groupForm example

// Go through each handler and let it generate its exposed widget.     foreach ($view->display_handler->handlers as $type => $value) {
      /** @var \Drupal\views\Plugin\views\ViewsHandlerInterface $handler */
      foreach ($view->$type as $id => $handler) {
        if ($handler->canExpose() && $handler->isExposed()) {
          // Grouped exposed filters have their own forms.           // Instead of render the standard exposed form, a new Select or           // Radio form field is rendered with the available groups.           // When a user chooses an option the selected value is split           // into the operator and value that the item represents.           if ($handler->isAGroup()) {
            $handler->groupForm($form$form_state);
            $id = $handler->options['group_info']['identifier'];
          }
          else {
            $handler->buildExposedForm($form$form_state);
          }
          if ($info = $handler->exposedInfo()) {
            $form['#info']["$type-$id"] = $info;
          }
        }
      }
    }

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