function asset_injector_get_assets in Asset Injector 8
Same name and namespace in other branches
- 8.2 asset_injector.module \asset_injector_get_assets()
Get all available assets.
Return value
\Drupal\asset_injector\AssetInjectorInterface[] Assets from css & js injectors.
3 calls to asset_injector_get_assets()
- asset_injector_ckeditor_css_alter in ./
asset_injector.module - Implements hook_ckeditor_css_alter().
- asset_injector_library_info_build in ./
asset_injector.module - Implements hook_library_info_build().
- asset_injector_page_attachments in ./
asset_injector.module - Implements hook_page_attachments().
File
- ./
asset_injector.module, line 126 - Contains module asset_injector.
Code
function asset_injector_get_assets() {
/** @var EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = \Drupal::entityTypeManager();
$assets = [];
foreach (asset_injector_get_entity_types() as $entity_type_id => $entity_type) {
$entity_type_storage = $entity_type_manager
->getStorage($entity_type_id);
$asset_ids = $entity_type_storage
->getQuery()
->execute();
foreach ($entity_type_storage
->loadMultiple($asset_ids) as $asset) {
$assets[] = $asset;
}
}
return $assets;
}