defaultDisplayOptions example

protected function rowStyleOptions() {
    $options = [];
    $options['entity:comment'] = $this->t('comments');
    $options['fields'] = $this->t('fields');
    return $options;
  }

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'access comments';

    // Add a relationship to nodes.     $display_options['relationships']['node']['id'] = 'node';
    $display_options['relationships']['node']['table'] = 'comment_field_data';
    $display_options['relationships']['node']['field'] = 'node';
    $display_options['relationships']['node']['entity_type'] = 'comment_field_data';
    $display_options['relationships']['node']['required'] = 1;
    


  /** * Builds an array of display options for the view. * * @return array * An array whose keys are the names of each display and whose values are * arrays of options for that display. */
  protected function buildDisplayOptions($form, FormStateInterface $form_state) {
    // Display: Default     $display_options['default'] = $this->defaultDisplayOptions();
    $display_options['default'] += [
      'filters' => [],
      'sorts' => [],
    ];
    $display_options['default']['filters'] += $this->defaultDisplayFilters($form$form_state);
    $display_options['default']['sorts'] += $this->defaultDisplaySorts($form$form_state);

    // Display: Page     if (!$form_state->isValueEmpty(['page', 'create'])) {
      $display_options['page'] = $this->pageDisplayOptions($form$form_state);

      
/** * Set the created column. * * @var string */
  protected $createdColumn = 'media_field_revision-created';

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'view all revisions';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    // Add the changed field.     $display_options['fields']['changed']['id'] = 'changed';
    $display_options['fields']['changed']['table'] = 'media_field_revision';
    
/** * Set the created column. * * @var string */
  protected $createdColumn = 'timestamp';

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'access site reports';

    return $display_options;
  }

}
'field' => 'status',
      'plugin_id' => 'boolean',
      'entity_type' => 'user',
      'entity_field' => 'status',
    ],
  ];

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'access user profiles';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    /* Field: User: Name */
    $display_options['fields']['name']['id'] = 'name';
    $display_options['fields']['name']['table'] = 'users_field_data';
    
/** * Set the created column. * * @var string */
  protected $createdColumn = 'created';

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    /* Field: File: Name */
    $display_options['fields']['filename']['id'] = 'filename';
    $display_options['fields']['filename']['table'] = 'file_managed';
    $display_options['fields']['filename']['field'] = 'filename';
    
$options['full_posts'] = $this->t('full posts');
    $options['titles'] = $this->t('titles');
    $options['titles_linked'] = $this->t('titles (linked)');
    $options['fields'] = $this->t('fields');
    return $options;
  }

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'access content';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    // Add the title field, so that the display has content if the user switches     // to a row style that uses fields.     /* Field: Content: Title */
    
protected function rowStyleOptions() {
    $options = parent::rowStyleOptions();
    unset($options['teasers']);
    unset($options['full_posts']);
    return $options;
  }

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'view all revisions';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    /* Field: Content revision: Created date */
    $display_options['fields']['changed']['id'] = 'changed';
    $display_options['fields']['changed']['table'] = 'node_field_revision';
    

class TaxonomyTerm extends WizardPluginBase {

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'access content';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    /* Field: Taxonomy: Term */
    $display_options['fields']['name']['id'] = 'name';
    $display_options['fields']['name']['table'] = 'taxonomy_term_field_data';
    

  public function getAvailableSorts() {
    return [
      'media_field_data-name:DESC' => $this->t('Media name'),
    ];
  }

  /** * {@inheritdoc} */
  protected function defaultDisplayOptions() {
    $display_options = parent::defaultDisplayOptions();

    // Add permission-based access control.     $display_options['access']['type'] = 'perm';
    $display_options['access']['options']['perm'] = 'view media';

    // Remove the default fields, since we are customizing them here.     unset($display_options['fields']);

    // Add the name field, so that the display has content if the user switches     // to a row style that uses fields.     $display_options['fields']['name']['id'] = 'name';
    
Home | Imprint | This part of the site doesn't use cookies.