optionsSummary example

protected function defineOptions() {
    $options = parent::defineOptions();
    $options['test_option'] = ['default' => ''];

    return $options;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    $categories['display_test'] = [
      'title' => $this->t('Display test settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -100,
      ],
    ];

    $test_option = $this->getOption('test_option') ?: $this->t('Empty');

    
$render += [
        '#title' => ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()],
      ];
    }
    return $render;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    $menu = $this->getOption('menu');
    if (!is_array($menu)) {
      $menu = ['type' => 'none'];
    }
    switch ($menu['type']) {
      case 'none':
      default:
        $menu_str = $this->t('No menu');
        break;

      
    unset($options['exposed_form']);
    unset($options['exposed_block']);
    unset($options['css_class']);

    return $options;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    // Authentication.     $auth = $this->getOption('auth') ? implode(', ', $this->getOption('auth')) : $this->t('No authentication is set');

    unset($categories['page']$categories['exposed']);
    // Hide some settings, as they aren't useful for pure data output.     unset($options['show_admin_links']$options['analyze-theme']);

    $categories['path'] = [
      'title' => $this->t('Path settings'),
      'column' => 'second',
      
return $positions;
  }

  /** * Provide the summary for attachment options in the views UI. * * This output is returned as an array. */
  public function optionsSummary(&$categories, &$options) {
    // It is very important to call the parent function here:     parent::optionsSummary($categories$options);

    $categories['attachment'] = [
      'title' => $this->t('Attachment settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -10,
      ],
    ];

    $displays = array_filter($this->getOption('displays'));
    if (count($displays) > 1) {
      
$options = $this->getOption('row');
      $options['type'] = $default_row_plugin;
      $this->setOption('row', $options);
    }
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    // Since we're childing off the 'path' type, we'll still *call* our     // category 'page' but let's override it so it says feed settings.     $categories['page'] = [
      'title' => $this->t('Feed settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -10,
      ],
    ];

    
$css_class = $this->t('None');
    }

    $options['css_class'] = [
      'category' => 'other',
      'title' => $this->t('CSS class'),
      'value' => $css_class,
      'desc' => $this->t('Change the CSS class name(s) that will be added to this display.'),
    ];

    foreach ($this->extenders as $extender) {
      $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);
    }
else {
      return $element;
    }
  }

  /** * Provide the summary for page options in the views UI. * * This output is returned as an array. */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    $categories['block'] = [
      'title' => $this->t('Block settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -10,
      ],
    ];

    $block_description = strip_tags($this->getOption('block_description'));
    if (empty($block_description)) {
      


    if (!empty($this->view->build_info['denied'])) {
      throw new AccessDeniedHttpException();
    }
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    $categories['page'] = [
      'title' => $this->t('Page settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -10,
      ],
    ];

    $path = strip_tags($this->getOption('path'));

    
// Set the display title to an empty string (not used in this display type).     $options['title']['default'] = '';
    $options['defaults']['default']['title'] = FALSE;

    return $options;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);
    // Disable 'title' so it won't be changed from the default set in     // \Drupal\views\Plugin\views\display\EntityReference::defineOptions.     unset($options['title']);
  }

  /** * {@inheritdoc} */
  public function getType() {
    return 'entity_reference';
  }

  
$options = parent::defineOptions();

    $options['test_extender_test_option'] = ['default' => $this->t('Empty')];

    return $options;
  }

  /** * {@inheritdoc} */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories$options);

    $categories['display_extender_test'] = [
      'title' => $this->t('Display extender test settings'),
      'column' => 'second',
      'build' => [
        '#weight' => -100,
      ],
    ];

    $options['test_extender_test_option'] = [
      'category' => 'display_extender_test',
      

    ];
    // Collapse the details by default.     $build['columns']['third']['#open'] = \Drupal::config('views.settings')->get('ui.show.advanced_column');

    // Each option (e.g. title, access, display as grid/table/list) fits into one     // of several "buckets," or boxes (Format, Fields, Sort, and so on).     $buckets = [];

    // Fetch options from the display plugin, with a list of buckets they go into.     $options = [];
    $view->getExecutable()->displayHandlers->get($display['id'])->optionsSummary($buckets$options);

    // Place each option into its bucket.     foreach ($options as $id => $option) {
      // Each option self-identifies as belonging in a particular bucket.       $buckets[$option['category']]['build'][$id] = $this->buildOptionForm($view$id$option$display);
    }

    // Place each bucket into the proper column.     foreach ($buckets as $id => $bucket) {
      // Let buckets identify themselves as belonging in a column.       if (isset($bucket['column']) && isset($build['columns'][$bucket['column']])) {
        
Home | Imprint | This part of the site doesn't use cookies.