protected function getDataAttributes(AssetInterface $asset) { $attributes = ''; foreach ($asset->getOptions() as $name => $value) { if ('data-' == substr($name, 0, 5)) { $attributes .= sprintf(' %s="%s"', $name, htmlspecialchars($value)); } } return $attributes; }
/** * Resolve asset dependencies. * * @param AssetInterface $asset * @param array $resolved * @param array $unresolved * @return array * @throws \RuntimeException */ public function resolveDependencies($asset, &$resolved = [], &$unresolved = []) { $unresolved[$asset->getName()] = $asset; if (isset($asset['dependencies'])) { foreach ($asset['dependencies'] as $dependency) { if (!isset($resolved[$dependency])) { if (isset($unresolved[$dependency])) { throw new \RuntimeException(sprintf('Circular asset dependency "%s > %s" detected.', $asset->getName(), $dependency)); } if ($d = $this->registered->get($dependency)) { $this->resolveDependencies($d, $resolved, $unresolved); } } } } $resolved[$asset->getName()] = $asset; unset($unresolved[$asset->getName()]); return $resolved; }