You are here

public static function Dropbutton::preRenderElement in Express 8

Pre-render element callback.

Parameters

\Drupal\bootstrap\Utility\Element $element: The element object.

Overrides PrerenderBase::preRenderElement

File

themes/contrib/bootstrap/src/Plugin/Prerender/Dropbutton.php, line 28
Contains \Drupal\bootstrap\Plugin\Prerender\Dropbutton.

Class

Dropbutton
Pre-render callback for the "dropbutton" element type.

Namespace

Drupal\bootstrap\Plugin\Prerender

Code

public static function preRenderElement(Element $element) {
  $element['#attached']['library'][] = 'bootstrap/dropdown';

  // Enable targeted theming of specific dropbuttons (e.g., 'operations' or
  // 'operations__node').
  if ($subtype = $element
    ->getProperty('subtype')) {
    $element
      ->setProperty('theme', $element
      ->getProperty('theme') . "__{$subtype}");
  }
}