TYPO3 CMS  TYPO3_6-2
AdditionalResourceService.php
Go to the documentation of this file.
1 <?php
3 
22 
26  protected $javaScriptResources = array();
27 
31  protected $stylesheetResources = array();
32 
36  static public function getInstance() {
37  return self::getObjectManager()->get('TYPO3\\CMS\\Workspaces\\Service\\AdditionalResourceService');
38  }
39 
43  static public function getObjectManager() {
44  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
45  }
46 
52  public function addJavaScriptResource($name, $resourcePath) {
53  $this->javaScriptResources[$name] = $this->resolvePath($resourcePath);
54  }
55 
61  public function addStylesheetResource($name, $resourcePath) {
62  $this->stylesheetResources[$name] = $this->resolvePath($resourcePath);
63  }
64 
68  public function getJavaScriptResources() {
70  }
71 
75  public function getStyleSheetResources() {
77  }
78 
83  protected function resolvePath($resourcePath) {
84  $absoluteFilePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($resourcePath);
85  $absolutePath = dirname($absoluteFilePath);
86  $fileName = basename($absoluteFilePath);
87 
88  return \TYPO3\CMS\Core\Utility\PathUtility::getRelativePathTo($absolutePath) . $fileName;
89  }
90 
91 }
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)