W3cubDocs

/Drupal 8

public function BubbleableMetadata::applyTo

public BubbleableMetadata::applyTo(array &$build)

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!BubbleableMetadata.php/function/BubbleableMetadata::applyTo/8.1.x