public static BubbleableMetadata::createFromObject($object)
Creates a bubbleable metadata object from a depended object.
\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.
static
Overrides CacheableMetadata::createFromObject
public static function createFromObject($object) { $meta = parent::createFromObject($object); if ($object instanceof AttachmentsInterface) { $meta->attachments = $object->getAttachments(); } return $meta; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!BubbleableMetadata.php/function/BubbleableMetadata::createFromObject/8.1.x