class PrerenderManager

Manages discovery and instantiation of Bootstrap pre-render callbacks.


Expanded class hierarchy of PrerenderManager

Related topics

1 file declares its use of PrerenderManager
ElementInfo.php in src/Plugin/Alter/ElementInfo.php


class PrerenderManager extends PluginManager {

   * Constructs a new \Drupal\bootstrap\Plugin\PrerenderManager object.
   * @param \Drupal\bootstrap\Theme $theme
   *   The theme to use for discovery.
  public function __construct(Theme $theme) {
    parent::__construct($theme, 'Plugin/Prerender', 'Drupal\bootstrap\Plugin\Prerender\PrerenderInterface', 'Drupal\bootstrap\Annotation\BootstrapPrerender');
    $this->setCacheBackend(\Drupal::cache('discovery'), 'theme:' . $theme->getName() . ':prerender', $this->getCacheTags());

   * Pre-render render array element callback.
   * @param array $element
   *   The render array element.
   * @return array
   *   The modified render array element.
  public static function preRender(array $element) {
    if (!empty($element['#bootstrap_ignore_pre_render'])) {
      return $element;

    $e = Element::create($element);

    if ($e->isType('machine_name')) {
      $e->addClass('form-inline', 'wrapper_attributes');

    // Add smart descriptions to the element, if necessary.

    return $element;



Contains filters are case sensitive
Name Modifiers Type Description
PluginManager::$theme protected property The current theme.
PluginManager::$themeHandler protected property The theme handler to check if theme exists.
PluginManager::$themeManager protected property The theme manager to invoke alter hooks.
PluginManager::alterDefinitions protected function
PluginManager::createInstance public function
PluginManager::getCacheTags public function Retrieves the cache tags used to invalidate caches.
PluginManager::getDefinitions public function
PluginManager::getDefinitionsLike public function Retrieves all definitions where the plugin ID matches a certain criteria.
PluginManager::providerExists protected function
PrerenderManager::preRender public static function Pre-render render array element callback.
PrerenderManager::__construct public function Constructs a new \Drupal\bootstrap\Plugin\PrerenderManager object. Overrides PluginManager::__construct