Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::createFromRenderArray()
  2. 9 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

9 calls to BubbleableMetadata::createFromRenderArray()
BubbleableMetadataTest::testCreateFromRenderArray in core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
@covers ::createFromRenderArray @dataProvider providerTestCreateFromRenderArray
EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext in core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php
Wraps a controller execution in a render context.
EntityField::getItems in core/modules/views/src/Plugin/views/field/EntityField.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']).

... See full list

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