Neos\Flow\ResourceManagement\ResourceManager::getPublicPackageResourceUri PHP Метод

getPublicPackageResourceUri() публичный Метод

Returns the public URI for a static resource provided by the specified package and in the given path below the package's resources directory.
public getPublicPackageResourceUri ( string $packageKey, string $relativePathAndFilename ) : string
$packageKey string Package key
$relativePathAndFilename string A relative path below the "Resources" directory of the package
Результат string
    public function getPublicPackageResourceUri($packageKey, $relativePathAndFilename)
    {
        $this->initialize();
        /** @var TargetInterface $target */
        $target = $this->collections[self::DEFAULT_STATIC_COLLECTION_NAME]->getTarget();
        return $target->getPublicStaticResourceUri($packageKey . '/' . $relativePathAndFilename);
    }

Usage Example

Пример #1
0
 /**
  * Get the header include code for including Twitter Bootstrap on a page. If needed
  * the jQuery library can be included, too.
  *
  * Example usage:
  * {namespace bootstrap=Neos\Twitter\Bootstrap\ViewHelpers}
  * <bootstrap:include />
  *
  * @param string $version The version to use, for example "2.2", "3.0" or also "2" or "3" meaning "2.x" and "3.x" respectively
  * @param boolean $minified If the minified version of Twitter Bootstrap should be used
  * @param boolean $includeJQuery If enabled, also includes jQuery
  * @param string $jQueryVersion The jQuery version to include
  * @return string
  */
 public function render($version, $minified = TRUE, $includeJQuery = FALSE, $jQueryVersion = '1.10.1')
 {
     $content = sprintf('<link rel="stylesheet" href="%s" />' . PHP_EOL, $this->resourceManager->getPublicPackageResourceUri('Neos\\Twitter.Bootstrap', $version . '/css/bootstrap' . ($minified === TRUE ? '.min' : '') . '.css'));
     if ($includeJQuery === TRUE) {
         $content .= sprintf('<script src="%s"></script>' . PHP_EOL, $this->resourceManager->getPublicPackageResourceUri('Neos\\Twitter.Bootstrap', 'Libraries/jQuery/jquery-' . $jQueryVersion . ($minified === TRUE ? '.min' : '') . '.js'));
     }
     $content .= sprintf('<script src="%s"></script>' . PHP_EOL, $this->resourceManager->getPublicPackageResourceUri('Neos\\Twitter.Bootstrap', $version . '/js/bootstrap' . ($minified === TRUE ? '.min' : '') . '.js'));
     return $content;
 }
All Usage Examples Of Neos\Flow\ResourceManagement\ResourceManager::getPublicPackageResourceUri