blockDisplayOptions example

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

      // Display: Feed (attached to the page)       if (!$form_state->isValueEmpty(['page', 'feed'])) {
        $display_options['feed'] = $this->pageFeedDisplayOptions($form$form_state);
      }
    }

    // Display: Block     if (!$form_state->isValueEmpty(['block', 'create'])) {
      $display_options['block'] = $this->blockDisplayOptions($form$form_state);
    }

    // Display: REST export.     if (!$form_state->isValueEmpty(['rest_export', 'create'])) {
      $display_options['rest_export'] = $this->restExportDisplayOptions($form$form_state);
    }

    return $display_options;
  }

  /** * Alters the full array of display options before they are added to the view. */
$display_options = parent::pageDisplayOptions($form$form_state);
    $row_plugin = $form_state->getValue(['page', 'style', 'row_plugin']);
    $row_options = $form_state->getValue(['page', 'style', 'row_options'][]);
    $this->display_options_row($display_options$row_plugin$row_options);
    return $display_options;
  }

  /** * {@inheritdoc} */
  protected function blockDisplayOptions(array $form, FormStateInterface $form_state) {
    $display_options = parent::blockDisplayOptions($form$form_state);
    $row_plugin = $form_state->getValue(['block', 'style', 'row_plugin']);
    $row_options = $form_state->getValue(['block', 'style', 'row_options'][]);
    $this->display_options_row($display_options$row_plugin$row_options);
    return $display_options;
  }

  /** * Set the row style and row style plugins to the display_options. */
  protected function display_options_row(&$display_options$row_plugin$row_options) {
    switch ($row_plugin) {
      
Home | Imprint | This part of the site doesn't use cookies.