function BubbleableMetadata::createFromObject
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::createFromObject()
- 10 core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::createFromObject()
- 11.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::createFromObject()
Creates a bubbleable metadata object from a depended object.
Parameters
\Drupal\Core\Cache\CacheableDependencyInterface|mixed $object: The object whose cacheability metadata to retrieve. If it implements CacheableDependencyInterface, its cacheability metadata will be used, otherwise, the passed in object must be assumed to be uncacheable, so max-age 0 is set.
Return value
static
Overrides CacheableMetadata::createFromObject
9 calls to BubbleableMetadata::createFromObject()
- CommentTokenReplaceTest::testCommentTokenReplacement in core/
modules/ comment/ tests/ src/ Functional/ CommentTokenReplaceTest.php - Creates a comment, then tests the tokens generated from it.
- FileTokenReplaceTest::testFileTokenReplacement in core/
modules/ file/ tests/ src/ Functional/ FileTokenReplaceTest.php - Creates a file, then tests the tokens generated from it.
- NodeTokenReplaceTest::testNodeTokenReplacement in core/
modules/ node/ tests/ src/ Kernel/ NodeTokenReplaceTest.php - Creates a node, then tests the tokens generated from it.
- TokenReplaceKernelTest::testSystemSiteTokenReplacement in core/
modules/ system/ tests/ src/ Kernel/ Token/ TokenReplaceKernelTest.php - Tests the generation of all system site information tokens.
- TokenReplaceTest::testTaxonomyTokenReplacement in core/
modules/ taxonomy/ tests/ src/ Functional/ TokenReplaceTest.php - Creates some terms and a node, then tests the tokens generated from them.
File
-
core/
lib/ Drupal/ Core/ Render/ BubbleableMetadata.php, line 82
Class
- BubbleableMetadata
- Value object used for bubbleable rendering metadata.
Namespace
Drupal\Core\RenderCode
public static function createFromObject($object) {
$meta = parent::createFromObject($object);
if ($object instanceof AttachmentsInterface) {
$meta->attachments = $object->getAttachments();
}
return $meta;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.