You are here

public static function BubbleableMetadata::createFromRenderArray in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::createFromRenderArray()

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

Parameters

array $build: A render array.

Return value

static

Overrides CacheableMetadata::createFromRenderArray

7 calls to BubbleableMetadata::createFromRenderArray()
BubbleableMetadataTest::testCreateFromRenderArray in core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
@covers ::createFromRenderArray @dataProvider providerTestCreateFromRenderArray
Field::getItems in core/modules/views/src/Plugin/views/field/Field.php
Gets an array of items for the field.
FormElement::processAutocomplete in core/lib/Drupal/Core/Render/Element/FormElement.php
Adds autocomplete functionality to elements.
HtmlResponseAttachmentsProcessor::renderPlaceholders in core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php
Renders placeholders (#attached['placeholders']).
MenuLinkContentCacheabilityBubblingTest::testOutboundPathAndRouteProcessing in core/modules/menu_link_content/src/Tests/MenuLinkContentCacheabilityBubblingTest.php
Tests bubbleable metadata of menu links' outbound route/path processing.

... See full list

File

core/lib/Drupal/Core/Render/BubbleableMetadata.php, line 70
Contains \Drupal\Core\Render\BubbleableMetadata.

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