Dropbutton.php

Same filename in this branch
  1. 11.x core/lib/Drupal/Core/Render/Element/Dropbutton.php
Same filename and directory in other branches
  1. 9 core/modules/views/src/Plugin/views/field/Dropbutton.php
  2. 9 core/lib/Drupal/Core/Render/Element/Dropbutton.php
  3. 8.9.x core/modules/views/src/Plugin/views/field/Dropbutton.php
  4. 8.9.x core/lib/Drupal/Core/Render/Element/Dropbutton.php
  5. 10 core/modules/views/src/Plugin/views/field/Dropbutton.php
  6. 10 core/lib/Drupal/Core/Render/Element/Dropbutton.php

Namespace

Drupal\views\Plugin\views\field

File

core/modules/views/src/Plugin/views/field/Dropbutton.php

View source
<?php

namespace Drupal\views\Plugin\views\field;

use Drupal\views\Attribute\ViewsField;
use Drupal\views\ResultRow;

/**
 * Provides a handler that renders links as dropbutton.
 *
 * @ingroup views_field_handlers
 */
class Dropbutton extends Links {
  
  /**
   * {@inheritdoc}
   */
  public function render(ResultRow $values) {
    $links = $this->getLinks();
    if (!empty($links)) {
      return [
        '#type' => 'dropbutton',
        '#links' => $links,
      ];
    }
    else {
      return '';
    }
  }

}

Classes

Title Deprecated Summary
Dropbutton Provides a handler that renders links as dropbutton.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.