BubbleableMetadata::createFromRenderArray

public static BubbleableMetadata::createFromRenderArray(array $build)

Creates a bubbleable metadata object with values taken from a render array.

Parameters

array $build: A render array.

Return value

static

Overrides CacheableMetadata::createFromRenderArray

File

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

Class

BubbleableMetadata
Value object used for bubbleable rendering metadata.

Namespace

Drupal\Core\Render

Code

public static function createFromRenderArray(array $build) {
  $meta = parent::createFromRenderArray($build);
  $meta->attachments = (isset($build['#attached'])) ? $build['#attached'] : [];
  return $meta;
}
doc_Drupal
2016-10-29 08:48:58
Comments
Leave a Comment

Please login to continue.