buildDisplayOptions example

'entity_field' => 'type',
        'plugin_id' => 'bundle',
      ];
    }
    return $filters;
  }

  /** * {@inheritdoc} */
  protected function buildDisplayOptions($form, FormStateInterface $form_state) {
    $display_options = parent::buildDisplayOptions($form$form_state);
    if (isset($display_options['default']['filters']['type'])) {
      $display_options['default']['relationships']['nid'] = [
        'id' => 'nid',
        'table' => 'node_field_revision',
        'field' => 'nid',
        'relationship' => 'none',
        'group_type' => 'group',
        'admin_label' => 'Get the actual content from a content revision.',
        'required' => 'true',
        'entity_type' => 'node',
        'entity_field' => 'nid',
        
    $values = [
      'id' => $form_state->getValue('id'),
      'label' => $form_state->getValue('label'),
      'description' => $form_state->getValue('description'),
      'base_table' => $this->base_table,
      'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
    ];

    $view = View::create($values);

    // Build all display options for this view.     $display_options = $this->buildDisplayOptions($form$form_state);

    // Allow the fully built options to be altered. This happens before adding     // the options to the view, so that once they are eventually added we will     // be able to get all the overrides correct.     $this->alterDisplayOptions($display_options$form$form_state);

    $this->addDisplays($view$display_options$form$form_state);

    return new ViewUI($view);
  }

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