You are here

public function AssetInjectorJs::libraryInfo in Asset Injector 8.2

Gets the library array used in library_info_build.

Return value

array Library info array for this asset.

Overrides AssetInjectorBase::libraryInfo

File

src/Entity/AssetInjectorJs.php, line 104

Class

AssetInjectorJs
Defines the Js Injector entity.

Namespace

Drupal\asset_injector\Entity

Code

public function libraryInfo() {
  $path = $this
    ->filePathRelativeToDrupalRoot();
  $library_info = [
    'header' => $this->header,
    'js' => [
      $path => [
        'preprocess' => $this->preprocess,
      ],
    ],
  ];
  if ($this->jquery) {
    $library_info['dependencies'] = [
      'core/jquery',
    ];
  }
  return $library_info;
}