You are here

public function AMPService::addComponentLibraries in Accelerated Mobile Pages (AMP) 8.2

Same name and namespace in other branches
  1. 8.3 src/Service/AMPService.php \Drupal\amp\Service\AMPService::addComponentLibraries()
  2. 8 src/Service/AMPService.php \Drupal\amp\Service\AMPService::addComponentLibraries()

Given an array of components e.g. amp-iframe, make an array of library

File

src/Service/AMPService.php, line 71

Class

AMPService
Class AMPService.

Namespace

Drupal\amp\Service

Code

public function addComponentLibraries(array $components) {
  $library_paths = [];

  /**
   * @var string $component_name
   * @var string $component_url We dont need this for now
   */
  foreach ($components as $component_name => $component_url) {
    if (isset($this->library_names[$component_name])) {
      $library_paths[] = $this->library_names[$component_name];
    }
  }
  return $library_paths;
}