views_ui_standard_display_dropdown example

$form['markup'] = ['#markup' => $this->t("Error: handler for @table > @field doesn't exist!", ['@table' => $item['table'], '@field' => $item['field']])];
      }
      else {
        $types = ViewExecutable::getHandlerTypes();
        $form['#title'] = $this->t('Configure @type: @item', ['@type' => $types[$type]['lstitle'], '@item' => $handler->adminLabel()]);

        // If this item can come from the default display, show a dropdown         // that lets the user choose which display the changes should apply to.         if ($executable->display_handler->defaultableSections($types[$type]['plural'])) {
          $section = $types[$type]['plural'];
          $form_state->set('section', $section);
          views_ui_standard_display_dropdown($form$form_state$section);
        }

        // A whole bunch of code to figure out what relationships are valid for         // this item.         $relationships = $executable->display_handler->getOption('relationships');
        $relationship_options = [];

        foreach ($relationships as $relationship) {
          // relationships can't link back to self. But also, due to ordering,           // relationships can only link to prior relationships.           if ($type == 'relationship' && $id == $relationship['id']) {
            
$extender->optionsSummary($categories$options);
    }
  }

  /** * {@inheritdoc} */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form$form_state);
    $section = $form_state->get('section');
    if ($this->defaultableSections($section)) {
      views_ui_standard_display_dropdown($form$form_state$section);
    }
    $form['#title'] = $this->display['display_title'] . ': ';

    // Set the 'section' to highlight on the form.     // If it's the item we're looking at is pulling from the default display,     // reflect that. Don't use is_defaulted since we want it to show up even     // on the default display.     if (!empty($this->options['defaults'][$section])) {
      $form['#section'] = 'default-' . $section;
    }
    else {
      
$form['markup'] = ['#markup' => $this->t('Invalid display id @display', ['@display' => $display_id])];
      return $form;
    }
    $display = $executable->displayHandlers->get($display_id);
    $form['#title'] = Html::escape($display->display['display_title']) . ': ';
    $form['#title'] .= $this->t('Rearrange @type', ['@type' => $types[$type]['ltitle']]);
    $form['#section'] = $display_id . 'rearrange-item';

    if ($display->defaultableSections($types[$type]['plural'])) {
      $section = $types[$type]['plural'];
      $form_state->set('section', $section);
      views_ui_standard_display_dropdown($form$form_state$section);
    }

    if (!empty($view->form_cache)) {
      $groups = $view->form_cache['groups'];
      $handlers = $view->form_cache['handlers'];
    }
    else {
      $groups = $display->getOption('filter_groups');
      $handlers = $display->getOption($types[$type]['plural']);
    }
    $count = 0;

    
if (!$executable->setDisplay($display_id)) {
      $form['markup'] = ['#markup' => $this->t('Invalid display id @display', ['@display' => $display_id])];
      return $form;
    }
    $display = &$executable->displayHandlers->get($display_id);
    $form['#title'] = $this->t('Rearrange @type', ['@type' => $types[$type]['ltitle']]);
    $form['#section'] = $display_id . 'rearrange-item';

    if ($display->defaultableSections($types[$type]['plural'])) {
      $section = $types[$type]['plural'];
      $form_state->set('section', $section);
      views_ui_standard_display_dropdown($form$form_state$section);
    }

    $count = 0;

    // Get relationship labels     $relationships = [];
    foreach ($display->getHandlers('relationship') as $id => $handler) {
      $relationships[$id] = $handler->adminLabel();
    }

    $form['fields'] = [
      
$ltitle = $types[$type]['ltitle'];
    $section = $types[$type]['plural'];

    if (!empty($types[$type]['type'])) {
      $type = $types[$type]['type'];
    }

    $form['#title'] = $this->t('Add @type', ['@type' => $ltitle]);
    $form['#section'] = $display_id . 'add-handler';

    // Add the display override dropdown.     views_ui_standard_display_dropdown($form$form_state$section);

    // Figure out all the base tables allowed based upon what the relationships provide.     $base_tables = $executable->getBaseTables();
    $options = Views::viewsDataHelper()->fetchFields(array_keys($base_tables)$type$display->useGroupBy()$form_state->get('type'));

    if (!empty($options)) {
      $form['override']['controls'] = [
        '#theme_wrappers' => ['container'],
        '#id' => 'views-filterable-options-controls',
        '#attributes' => ['class' => ['form--inline', 'views-filterable-options-controls']],
      ];
      
Home | Imprint | This part of the site doesn't use cookies.