public function AMPService::addComponentLibraries in Accelerated Mobile Pages (AMP) 8.3
Same name and namespace in other branches
- 8 src/Service/AMPService.php \Drupal\amp\Service\AMPService::addComponentLibraries()
- 8.2 src/Service/AMPService.php \Drupal\amp\Service\AMPService::addComponentLibraries()
Given an array of discovered JS requirements, identify related libraries.
Parameters
array $components: An array of javascript urls that the AMP library discovered.
Return value
array An array of the Drupal libraries that include this javascript.
File
- src/
Service/ AMPService.php, line 118
Class
- AMPService
- Class AMPService.
Namespace
Drupal\amp\ServiceCode
public function addComponentLibraries(array $components) {
$library_names = [];
$map = $this
->mapJSToNames();
foreach ($components as $component_url) {
if (isset($map[$component_url])) {
$library_names[] = $map[$component_url];
}
}
return $library_names;
}