public function LightgalleryManager::loadLibraries in Lightgallery 8
Loads libraries to init lightgallery.
Parameters
int $id: The id.
Return value
array The array.
File
- src/
Manager/ LightgalleryManager.php, line 67
Class
- LightgalleryManager
- Light gallery manager.
Namespace
Drupal\lightgallery\ManagerCode
public function loadLibraries($id) {
$attached = [];
// JavaScript settings.
$js_settings = [
'instances' => [
$id => $this->optionSet
->get(),
],
];
// Add settings.
$attached['drupalSettings']['lightgallery'] = $js_settings;
// Add loader file.
// We don't need to add the lightgallery library manually,
// Because there is a dependency on it.
$attached['library'][] = 'lightgallery/lightgallery.load';
return $attached;
}