function BubbleableMetadata::addCacheableDependency

Same name in other branches
  1. 9 core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::addCacheableDependency()
  2. 8.9.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::addCacheableDependency()
  3. 11.x core/lib/Drupal/Core/Render/BubbleableMetadata.php \Drupal\Core\Render\BubbleableMetadata::addCacheableDependency()

Overrides RefinableCacheableDependencyTrait::addCacheableDependency

File

core/lib/Drupal/Core/Render/BubbleableMetadata.php, line 95

Class

BubbleableMetadata
Value object used for bubbleable rendering metadata.

Namespace

Drupal\Core\Render

Code

public function addCacheableDependency($other_object) {
    parent::addCacheableDependency($other_object);
    if ($other_object instanceof AttachmentsInterface) {
        $this->addAttachments($other_object->getAttachments());
    }
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.