You are here

public function ArrayObject::addCacheableDependency in Express 8

Adds a dependency on an object: merges its cacheability metadata.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface|object $other_object: The dependency. If the object implements CacheableDependencyInterface, then 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

$this

Overrides RefinableCacheableDependencyInterface::addCacheableDependency

See also

\Drupal\Core\Cache\CacheableMetadata::createFromObject()

File

themes/contrib/bootstrap/src/Utility/ArrayObject.php, line 116
Contains \Drupal\bootstrap\Utility\ArrayObject.

Class

ArrayObject
Custom ArrayObject implementation.

Namespace

Drupal\bootstrap\Utility

Code

public function addCacheableDependency($other_object) {
  BubbleableMetadata::createFromRenderArray($this->array)
    ->addCacheableDependency($other_object)
    ->applyTo($this->array);
  return $this;
}