本文整理汇总了PHP中TYPO3\Flow\Resource\ResourceManager::getPublicPackageResourceUriByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceManager::getPublicPackageResourceUriByPath方法的具体用法?PHP ResourceManager::getPublicPackageResourceUriByPath怎么用?PHP ResourceManager::getPublicPackageResourceUriByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Resource\ResourceManager
的用法示例。
在下文中一共展示了ResourceManager::getPublicPackageResourceUriByPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders an <img> HTML tag for a filetype icon for a given TYPO3.Media's asset instance
*
* @param AssetInterface $file
* @param integer|null $width
* @param integer|null $height
* @return string
*/
public function render(AssetInterface $file, $width = null, $height = null)
{
$icon = FileTypeIconService::getIcon($file, $width, $height);
$this->tag->addAttribute('src', $this->resourceManager->getPublicPackageResourceUriByPath($icon['src']));
$this->tag->addAttribute('alt', $icon['alt']);
if ($width !== null) {
$this->tag->addAttribute('width', $width);
}
if ($height !== null) {
$this->tag->addAttribute('height', $height);
}
return $this->tag->render();
}
示例2: getUriForThumbnail
/**
* @param ImageInterface $thumbnail
* @return string
* @throws ThumbnailServiceException
*/
public function getUriForThumbnail(ImageInterface $thumbnail)
{
$resource = $thumbnail->getResource();
if ($resource) {
return $this->resourceManager->getPublicPersistentResourceUri($resource);
}
$staticResource = $thumbnail->getStaticResource();
if ($staticResource === null) {
throw new ThumbnailServiceException(sprintf('Could not generate URI for static thumbnail "%s".', $this->persistenceManager->getIdentifierByObject($thumbnail)), 1450178437);
}
return $this->resourceManager->getPublicPackageResourceUriByPath($staticResource);
}
示例3: translateAndConvertHelpMessage
/**
* If ui.help.message is set in $configuration, translate it if requested and then convert it from markdown to HTML.
*
* @param array $configuration
* @param string $idPrefix
* @param string $nodeTypeName
* @return void
*/
protected function translateAndConvertHelpMessage(array &$configuration, $idPrefix, $nodeTypeName = null)
{
$helpMessage = '';
if (isset($configuration['ui']['help'])) {
// message handling
if (isset($configuration['ui']['help']['message'])) {
if ($this->shouldFetchTranslation($configuration['ui']['help'], 'message')) {
$translationIdentifier = $this->splitIdentifier($idPrefix . 'ui.help.message');
$helpMessage = $this->translator->translateById($translationIdentifier['id'], [], null, null, $translationIdentifier['source'], $translationIdentifier['packageKey']);
} else {
$helpMessage = $configuration['ui']['help']['message'];
}
}
// prepare thumbnail
if ($nodeTypeName !== null) {
$thumbnailUrl = '';
if (isset($configuration['ui']['help']['thumbnail'])) {
$thumbnailUrl = $configuration['ui']['help']['thumbnail'];
if (strpos($thumbnailUrl, 'resource://') === 0) {
$thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($thumbnailUrl);
}
} else {
# look in well know location
$splitPrefix = $this->splitIdentifier($nodeTypeName);
$relativePathAndFilename = 'NodeTypes/Thumbnails/' . $splitPrefix['id'] . '.png';
$resourcePath = 'resource://' . $splitPrefix['packageKey'] . '/Public/' . $relativePathAndFilename;
if (file_exists($resourcePath)) {
$thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($resourcePath);
}
}
if ($thumbnailUrl !== '') {
$helpMessage = '![alt text](' . $thumbnailUrl . ') ' . $helpMessage;
}
}
if ($helpMessage !== '') {
$helpMessage = $this->markdownConverter->convertToHtml($helpMessage);
$helpMessage = $this->addTargetAttribute($helpMessage);
}
}
$configuration['ui']['help']['message'] = $helpMessage;
}
开发者ID:simonschaufi,项目名称:neos-development-collection,代码行数:49,代码来源:NodeTypeConfigurationEnrichmentAspect.php