You are here

Dropbutton.php in Express 8

File

themes/contrib/bootstrap/src/Plugin/Prerender/Dropbutton.php
View source
<?php

/**
 * @file
 * Contains \Drupal\bootstrap\Plugin\Prerender\Dropbutton.
 */
namespace Drupal\bootstrap\Plugin\Prerender;

use Drupal\bootstrap\Annotation\BootstrapPrerender;
use Drupal\bootstrap\Utility\Element;

/**
 * Pre-render callback for the "dropbutton" element type.
 *
 * @ingroup plugins_prerender
 *
 * @BootstrapPrerender("dropbutton",
 *   replace = "Drupal\Core\Render\Element\Dropbutton::preRenderDropbutton"
 * )
 *
 * @see \Drupal\Core\Render\Element\Dropbutton::preRenderDropbutton()
 */
class Dropbutton extends PrerenderBase {

  /**
   * {@inheritdoc}
   */
  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}");
    }
  }

}

Classes

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