You are here

public function JsInjector::libraryInfo in Asset Injector 8

Gets the library array used in library_info_build.

Return value

array Library info array for this asset.

Overrides AssetInjectorBase::libraryInfo

File

src/Entity/JsInjector.php, line 76

Class

JsInjector
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;
}