You are here

public static function BubbleableMetadata::createFromRenderArray in Drupal 9

Same name and namespace in other branches
  1. 8 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

8 calls to BubbleableMetadata::createFromRenderArray()
BubbleableMetadataTest::testCreateFromRenderArray in core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php
@covers ::createFromRenderArray @dataProvider providerTestCreateFromRenderArray
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']).
MediaEmbed::renderIntoDomNode in core/modules/media/src/Plugin/Filter/MediaEmbed.php
Renders the given render array into the given DOM node.

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