class MultipleAssetLibraryType in Libraries API 8.3
Plugin annotation
@LibraryType("asset_multiple");
Hierarchy
- class \Drupal\libraries\ExternalLibrary\Type\LibraryTypeBase implements ContainerFactoryPluginInterface, LibraryCreationListenerInterface, LibraryTypeInterface uses IdAccessorTrait
- class \Drupal\libraries\Plugin\libraries\Type\MultipleAssetLibraryType implements AttachableAssetLibraryRegistrationInterface
Expanded class hierarchy of MultipleAssetLibraryType
File
- src/
Plugin/ libraries/ Type/ MultipleAssetLibraryType.php, line 15
Namespace
Drupal\libraries\Plugin\libraries\TypeView source
class MultipleAssetLibraryType extends LibraryTypeBase implements AttachableAssetLibraryRegistrationInterface {
/**
* {@inheritdoc}
*/
public function getLibraryClass() {
return MultipleAssetLibrary::class;
}
/**
* {@inheritdoc}
*/
public function getAttachableAssetLibraries(LibraryInterface $external_library, LibraryManagerInterface $library_manager) {
assert($external_library instanceof \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface);
/** @var \Drupal\libraries\ExternalLibrary\Asset\MultipleAssetLibraryInterface $external_library */
$attachable_libraries = [];
foreach ($external_library
->getAttachableAssetLibraries($library_manager) as $component_name => $attachable_library) {
$attachable_library_id = $this
->getAttachableLibraryId($external_library, $component_name);
$attachable_libraries[$attachable_library_id] = $attachable_library;
}
return $attachable_libraries;
}
/**
* @param \Drupal\libraries\ExternalLibrary\LibraryInterface $external_library
* @param string $component_name
*
* @return string
*/
protected function getAttachableLibraryId(LibraryInterface $external_library, $component_name) {
return $external_library
->getId() . MultipleAssetLibraryInterface::SEPARATOR . $component_name;
}
}