file Dropbutton.php

Namespace

Drupal\bootstrap\Plugin\Prerender
  1. <?php
  2. namespace Drupal\bootstrap\Plugin\Prerender;
  3. use Drupal\bootstrap\Utility\Element;
  4. /**
  5. * Pre-render callback for the "dropbutton" element type.
  6. *
  7. * @ingroup plugins_prerender
  8. *
  9. * @BootstrapPrerender("dropbutton",
  10. * replace = "Drupal\Core\Render\Element\Dropbutton::preRenderDropbutton"
  11. * )
  12. *
  13. * @see \Drupal\Core\Render\Element\Dropbutton::preRenderDropbutton()
  14. */
  15. class Dropbutton extends PrerenderBase {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function preRenderElement(Element $element) {
  20. $element['#attached']['library'][] = 'bootstrap/dropdown';
  21. // Enable targeted theming of specific dropbuttons (e.g., 'operations' or
  22. // 'operations__node').
  23. if ($subtype = $element->getProperty('subtype')) {
  24. $element->setProperty('theme', $element->getProperty('theme') . "__$subtype");
  25. }
  26. }
  27. }

Classes

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