public BubbleableMetadata::merge(CacheableMetadata $other)
Merges the values of another bubbleable metadata object with this one.
\Drupal\Core\Cache\CacheableMetadata $other: The other bubbleable metadata object.
static A new bubbleable metadata object, with the merged data.
Overrides CacheableMetadata::merge
public function merge(CacheableMetadata $other) { $result = parent::merge($other); // This is called many times per request, so avoid merging unless absolutely // necessary. if ($other instanceof BubbleableMetadata) { if (empty($this->attachments)) { $result->attachments = $other->attachments; } elseif (empty($other->attachments)) { $result->attachments = $this->attachments; } else { $result->attachments = static::mergeAttachments($this->attachments, $other->attachments); } } return $result; }
© 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::merge/8.1.x