You are here

public function Skin::addJS in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/Skin.php \Drupal\forena\Skin::addJS()

Parameters

string $script: The filename of the script to be added.

1 call to Skin::addJS()
Skin::loadSkinFiles in src/Skin.php
Adds on report specific skin files to

File

src/Skin.php, line 91
Implements \Drupal\forena\Skins

Class

Skin
Class Skin A skin is a collectio of css and js files that need to get used by an application or reports. Skins are idntified by .fri files contained in the report directory.

Namespace

Drupal\forena

Code

public function addJS($script) {
  if (strpos($script, 'http:') === 0 || strpos($script, 'https:') === 0) {
    $this->scripts[] = $script;
  }
  elseif ($this
    ->reportFileSystem()
    ->exists($script)) {
    $this->scripts[] = $this
      ->reportFileSystem()
      ->path($script);
  }
  elseif (file_exists('sites/all/libraries/' . $script)) {
    $this->scripts[] = 'sites/all/libraries/' . $script;
  }
  elseif (file_exists($script)) {
    $this->scripts[] = $script;
  }
}