function BubbleableMetadata::applyTo

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::applyTo()
  2. 8.9.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::applyTo()
  3. 11.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::applyTo()

Applies the values of this bubbleable metadata object to a render array.

Parameters

array &$build: A render array.

Overrides CacheableMetadata::applyTo

File

core/lib/Drupal/Core/Render/BubbleableMetadata.php, line 52

Class

BubbleableMetadata
Value object used for bubbleable rendering metadata.

Namespace

Drupal\Core\Render

Code

public function applyTo(array &$build) {
    parent::applyTo($build);
    $build['#attached'] = $this->attachments;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.