addFile() public method

public addFile ( string $file )
$file string
Beispiel #1
0
 /**
  * @param string $file
  */
 public function addFile($file)
 {
     $ext = pathinfo($file, PATHINFO_EXTENSION);
     switch ($ext) {
         case 'js':
             $this->js->addFile($file);
             break;
         case 'css':
         case 'less':
             $this->less->addFile($file);
             break;
         default:
             throw new DomainException('Unsupported asset type: ' . $ext);
     }
 }
 /**
  * @param string $layout
  * @param WebAppAssets $assets
  * @param Client $api
  * @param Factory $view
  * @param LocaleManager $locales
  * @param AbstractSerializer $userSerializer
  */
 public function __construct($layout, WebAppAssets $assets, Client $api, Factory $view, LocaleManager $locales, AbstractSerializer $userSerializer)
 {
     $this->layout = $layout;
     $this->api = $api;
     $this->assets = $assets;
     $this->view = $view;
     $this->locales = $locales;
     $this->userSerializer = $userSerializer;
     $this->addHeadString('<link rel="stylesheet" href="//fonts.css.network/css?family=Open+Sans:400italic,700italic,400,700,600">', 'font');
     $this->js = $this->assets->getJs();
     $this->css = $this->assets->getCss();
     $locale = $this->locales->getLocale();
     $this->localeJs = $this->assets->getLocaleJs($locale);
     $this->localeCss = $this->assets->getLocaleCss($locale);
     foreach ($this->locales->getJsFiles($locale) as $file) {
         $this->localeJs->addFile($file);
     }
     foreach ($this->locales->getCssFiles($locale) as $file) {
         $this->localeCss->addFile($file);
     }
 }