public static function Dropbutton::preRenderDropbutton

public static Dropbutton::preRenderDropbutton($element)

Pre-render callback: Attaches the dropbutton library and required markup.

File

core/lib/Drupal/Core/Render/Element/Dropbutton.php, line 60

Class

Dropbutton
Provides a render element for a set of links rendered as a drop-down button.

Namespace

Drupal\Core\Render\Element

Code

public static function preRenderDropbutton($element) {
  $element['#attached']['library'][] = 'core/drupal.dropbutton';
  $element['#attributes']['class'][] = 'dropbutton';
  if (!isset($element['#theme_wrappers'])) {
    $element['#theme_wrappers'] = array();
  }
  array_unshift($element['#theme_wrappers'], 'dropbutton_wrapper');

  // Enable targeted theming of specific dropbuttons (e.g., 'operations' or
  // 'operations__node').
  if (isset($element['#subtype'])) {
    $element['#theme'] .= '__' . $element['#subtype'];
  }

  return $element;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element!Dropbutton.php/function/Dropbutton::preRenderDropbutton/8.1.x