本文整理汇总了PHP中TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PathUtility::getAbsoluteWebPath方法的具体用法?PHP PathUtility::getAbsoluteWebPath怎么用?PHP PathUtility::getAbsoluteWebPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\PathUtility
的用法示例。
在下文中一共展示了PathUtility::getAbsoluteWebPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Index action shows install tool / step installer or redirect to action to enable install tool
*
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
*/
public function index(ServerRequestInterface $request, ResponseInterface $response)
{
/** @var EnableFileService $enableFileService */
$enableFileService = GeneralUtility::makeInstance(EnableFileService::class);
/** @var AbstractFormProtection $formProtection */
$formProtection = FormProtectionFactory::get();
if ($enableFileService->checkInstallToolEnableFile()) {
// Install tool is open and valid, redirect to it
$response = $response->withStatus(303)->withHeader('Location', 'sysext/install/Start/Install.php?install[context]=backend');
} elseif ($request->getMethod() === 'POST' && $request->getParsedBody()['action'] === 'enableInstallTool') {
// Request to open the install tool
$installToolEnableToken = $request->getParsedBody()['installToolEnableToken'];
if (!$formProtection->validateToken($installToolEnableToken, 'installTool')) {
throw new \RuntimeException('Given form token was not valid', 1369161225);
}
$enableFileService->createInstallToolEnableFile();
// Install tool is open and valid, redirect to it
$response = $response->withStatus(303)->withHeader('Location', 'sysext/install/Start/Install.php?install[context]=backend');
} else {
// Show the "create enable install tool" button
/** @var StandaloneView $view */
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/Templates/BackendModule/ShowEnableInstallToolButton.html'));
$token = $formProtection->generateToken('installTool');
$view->assign('installToolEnableToken', $token);
/** @var ModuleTemplate $moduleTemplate */
$moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
$cssFile = 'EXT:install/Resources/Public/Css/BackendModule/ShowEnableInstallToolButton.css';
$cssFile = GeneralUtility::getFileAbsFileName($cssFile);
$moduleTemplate->getPageRenderer()->addCssFile(PathUtility::getAbsoluteWebPath($cssFile));
$moduleTemplate->setContent($view->render());
$response->getBody()->write($moduleTemplate->renderContent());
}
return $response;
}
示例2: render
/**
* @param string $identifier
*
* @return string
*/
public function render($identifier = '')
{
$basePath = 'sysext/t3skin/images/icons/';
$nameParts = GeneralUtility::trimExplode('-', $identifier);
$folder = array_shift($nameParts);
$basePath .= $folder . '/' . implode('-', $nameParts) . '.png';
return '<img src="' . PathUtility::getAbsoluteWebPath($basePath) . '" />';
}
示例3: generateMarkup
/**
* @param Icon $icon
* @param array $options
* @return string
* @throws \InvalidArgumentException
*/
protected function generateMarkup(Icon $icon, array $options)
{
if (empty($options['source'])) {
throw new \InvalidArgumentException('[' . $icon->getIdentifier() . '] The option "source" is required and must not be empty', 1440754980);
}
$source = $options['source'];
if (StringUtility::beginsWith($source, 'EXT:') || !StringUtility::beginsWith($source, '/')) {
$source = GeneralUtility::getFileAbsFileName($source);
}
$source = PathUtility::getAbsoluteWebPath($source);
return '<img src="' . htmlspecialchars($source) . '" width="' . $icon->getDimension()->getWidth() . '" height="' . $icon->getDimension()->getHeight() . '" />';
}
示例4: initializeAction
/**
* Initializes the controller before invoking an action method.
*
* @return void
*/
protected function initializeAction()
{
$this->pageRenderer = $this->getPageRenderer();
// @todo Evaluate how the intval() call can be used with Extbase validators/filters
$this->pageId = (int) GeneralUtility::_GP('id');
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icons = array('language' => $iconFactory->getIcon('flags-multiple', Icon::SIZE_SMALL)->render(), 'integrity' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(), 'success' => $iconFactory->getIcon('status-dialog-ok', Icon::SIZE_SMALL)->render(), 'info' => $iconFactory->getIcon('status-dialog-information', Icon::SIZE_SMALL)->render(), 'warning' => $iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render(), 'error' => $iconFactory->getIcon('status-dialog-error', Icon::SIZE_SMALL)->render());
$this->pageRenderer->addInlineSetting('Workspaces', 'icons', $icons);
$this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
$this->pageRenderer->addInlineSetting('Workspaces', 'depth', $this->pageId === 0 ? 999 : 1);
$this->pageRenderer->addInlineSetting('Workspaces', 'language', $this->getLanguageSelection());
$cssFile = 'EXT:workspaces/Resources/Public/Css/module.css';
$cssFile = GeneralUtility::getFileAbsFileName($cssFile);
$this->pageRenderer->addCssFile(PathUtility::getAbsoluteWebPath($cssFile));
$this->pageRenderer->addInlineLanguageLabelArray(array('title' => $GLOBALS['LANG']->getLL('title'), 'path' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path'), 'table' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.table'), 'depth' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_perm.xlf:Depth'), 'depth_0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'), 'depth_1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'), 'depth_2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'), 'depth_3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'), 'depth_4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'), 'depth_infi' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')));
$this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf');
$this->assignExtensionSettings();
}
示例5: addTcaTypeIcon
/**
* Add the given icon to the TCA table type
*
* @param string $table
* @param string $type
* @param string $icon
*/
public static function addTcaTypeIcon($table, $type, $icon)
{
if (GeneralUtility::compat_version('7.0')) {
$fullIconPath = substr(PathUtility::getAbsoluteWebPath($icon), 1);
if (StringUtility::endsWith(strtolower($fullIconPath), 'svg')) {
$iconProviderClass = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\SvgIconProvider';
} else {
$iconProviderClass = 'TYPO3\\CMS\\Core\\Imaging\\IconProvider\\BitmapIconProvider';
}
/** @var IconRegistry $iconRegistry */
$iconRegistry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconRegistry');
$iconIdentifier = 'tcarecords-' . $table . '-' . $type;
$iconRegistry->registerIcon($iconIdentifier, $iconProviderClass, ['source' => $fullIconPath]);
$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$type] = $iconIdentifier;
} else {
$fullIconPath = str_replace('../typo3/', '', $icon);
SpriteManager::addTcaTypeIcon('tt_content', $type, $fullIconPath);
}
}
示例6: getUriForFileName
/**
* Returns the uri of a relative reference, resolves the "EXT:" prefix
* (way of referring to files inside extensions) and checks that the file is inside
* the PATH_site of the TYPO3 installation
*
* @param string $filename The input filename/filepath to evaluate
* @return string Returns the filename of $filename if valid, otherwise blank string.
* @internal
*/
private function getUriForFileName($filename)
{
if (strpos($filename, '://')) {
return $filename;
}
$urlPrefix = '';
if (strpos($filename, 'EXT:') === 0) {
$absoluteFilename = GeneralUtility::getFileAbsFileName($filename);
$filename = '';
if ($absoluteFilename !== '') {
$filename = PathUtility::getAbsoluteWebPath($absoluteFilename);
}
} elseif (strpos($filename, '/') !== 0) {
$urlPrefix = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
}
return $urlPrefix . $filename;
}
示例7: getBackendFavicon
/**
* Retrieves configured favicon for backend (with fallback)
*
* @return string
*/
protected function getBackendFavicon()
{
return PathUtility::getAbsoluteWebPath($GLOBALS['TBE_STYLES']['favicon'] ?: ExtensionManagementUtility::extPath('backend') . 'Resources/Public/Icons/favicon.ico');
}
示例8: buildUri
/**
* Internal method building a Uri object, merging the GET parameters array into a flat queryString
*
* @param array $parameters An array of GET parameters
* @param string $referenceType The type of reference to be generated (one of the constants)
*
* @return Uri
*/
protected function buildUri($parameters, $referenceType)
{
$uri = 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $parameters, '', true, true), '&');
if ($referenceType === self::ABSOLUTE_PATH) {
$uri = PathUtility::getAbsoluteWebPath(PATH_typo3 . $uri);
} else {
$uri = GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR') . $uri;
}
return GeneralUtility::makeInstance(Uri::class, $uri);
}
示例9: renderContentWithHeader
//.........这里部分代码省略.........
} else {
$_attr = '';
}
$htmlTag = '<html' . ($_attr ? ' ' . $_attr : '') . '>';
if (isset($tsfe->config['config']['htmlTag_stdWrap.'])) {
$htmlTag = $tsfe->cObj->stdWrap($htmlTag, $tsfe->config['config']['htmlTag_stdWrap.']);
}
$pageRenderer->setHtmlTag($htmlTag);
// Head tag:
$headTag = $tsfe->pSetup['headTag'] ?: '<head>';
if (isset($tsfe->pSetup['headTag.'])) {
$headTag = $tsfe->cObj->stdWrap($headTag, $tsfe->pSetup['headTag.']);
}
$pageRenderer->setHeadTag($headTag);
// Setting charset meta tag:
$pageRenderer->setCharSet($theCharset);
$pageRenderer->addInlineComment(' This website is powered by TYPO3 - inspiring people to share!
TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
TYPO3 is copyright ' . TYPO3_copyright_year . ' of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Information and contribution at ' . TYPO3_URL_GENERAL . '
');
if ($tsfe->baseUrl) {
$pageRenderer->setBaseUrl($tsfe->baseUrl);
}
if ($tsfe->pSetup['shortcutIcon']) {
$favIcon = ltrim($tsfe->tmpl->getFileName($tsfe->pSetup['shortcutIcon']), '/');
$iconFileInfo = GeneralUtility::makeInstance(ImageInfo::class, PATH_site . $favIcon);
if ($iconFileInfo->isFile()) {
$iconMimeType = $iconFileInfo->getMimeType();
if ($iconMimeType) {
$iconMimeType = ' type="' . $iconMimeType . '"';
$pageRenderer->setIconMimeType($iconMimeType);
}
$pageRenderer->setFavIcon(PathUtility::getAbsoluteWebPath($tsfe->absRefPrefix . $favIcon));
}
}
// Including CSS files
if (is_array($tsfe->tmpl->setup['plugin.'])) {
$stylesFromPlugins = '';
foreach ($tsfe->tmpl->setup['plugin.'] as $key => $iCSScode) {
if (is_array($iCSScode)) {
if ($iCSScode['_CSS_DEFAULT_STYLE'] && empty($tsfe->config['config']['removeDefaultCss'])) {
if (isset($iCSScode['_CSS_DEFAULT_STYLE.'])) {
$cssDefaultStyle = $tsfe->cObj->stdWrap($iCSScode['_CSS_DEFAULT_STYLE'], $iCSScode['_CSS_DEFAULT_STYLE.']);
} else {
$cssDefaultStyle = $iCSScode['_CSS_DEFAULT_STYLE'];
}
$stylesFromPlugins .= '/* default styles for extension "' . substr($key, 0, -1) . '" */' . LF . $cssDefaultStyle . LF;
}
if ($iCSScode['_CSS_PAGE_STYLE'] && empty($tsfe->config['config']['removePageCss'])) {
$cssPageStyle = implode(LF, $iCSScode['_CSS_PAGE_STYLE']);
if (isset($iCSScode['_CSS_PAGE_STYLE.'])) {
$cssPageStyle = $tsfe->cObj->stdWrap($cssPageStyle, $iCSScode['_CSS_PAGE_STYLE.']);
}
$cssPageStyle = '/* specific page styles for extension "' . substr($key, 0, -1) . '" */' . LF . $cssPageStyle;
self::addCssToPageRenderer($cssPageStyle, true);
}
}
}
if (!empty($stylesFromPlugins)) {
self::addCssToPageRenderer($stylesFromPlugins);
}
}
if ($tsfe->pSetup['stylesheet']) {
$ss = $tsfe->tmpl->getFileName($tsfe->pSetup['stylesheet']);
if ($ss) {
示例10: indexAction
/**
* Basically makes sure that the workspace preview is rendered.
* The preview itself consists of three frames, so there are
* only the frames-urls we've to generate here
*
* @param int $previewWS
* @return void
*/
public function indexAction($previewWS = null)
{
$backendUser = $this->getBackendUser();
// Get all the GET parameters to pass them on to the frames
$queryParameters = GeneralUtility::_GET();
// Remove the GET parameters related to the workspaces module and the page id
unset($queryParameters['tx_workspaces_web_workspacesworkspaces']);
unset($queryParameters['M']);
unset($queryParameters['id']);
// Assemble a query string from the retrieved parameters
$queryString = GeneralUtility::implodeArrayForUrl('', $queryParameters);
// fetch the next and previous stage
$workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), $filter = 1, $stage = -99, $this->pageId, $recursionLevel = 0, $selectionType = 'tables_modify');
list(, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray);
list(, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
/** @var $wsService WorkspaceService */
$wsService = GeneralUtility::makeInstance(WorkspaceService::class);
$wsList = $wsService->getAvailableWorkspaces();
$activeWorkspace = $backendUser->workspace;
if (!is_null($previewWS)) {
if (in_array($previewWS, array_keys($wsList)) && $activeWorkspace != $previewWS) {
$activeWorkspace = $previewWS;
$backendUser->setWorkspace($activeWorkspace);
BackendUtility::setUpdateSignal('updatePageTree');
}
}
/** @var $uriBuilder UriBuilder */
$uriBuilder = $this->objectManager->get(UriBuilder::class);
$wsSettingsPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
$wsSettingsUri = $uriBuilder->uriFor('singleIndex', array(), ReviewController::class, 'workspaces', 'web_workspacesworkspaces');
$wsSettingsParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Review';
$wsSettingsUrl = $wsSettingsPath . $wsSettingsUri . $wsSettingsParams;
$viewDomain = BackendUtility::getViewDomain($this->pageId);
$wsBaseUrl = $viewDomain . '/index.php?id=' . $this->pageId . $queryString;
// @todo - handle new pages here
// branchpoints are not handled anymore because this feature is not supposed anymore
if (WorkspaceService::isNewPage($this->pageId)) {
$wsNewPageUri = $uriBuilder->uriFor('newPage', array(), PreviewController::class, 'workspaces', 'web_workspacesworkspaces');
$wsNewPageParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Preview';
$liveUrl = $wsSettingsPath . $wsNewPageUri . $wsNewPageParams . '&ADMCMD_prev=IGNORE';
} else {
$liveUrl = $wsBaseUrl . '&ADMCMD_noBeUser=1&ADMCMD_prev=IGNORE';
}
$wsUrl = $wsBaseUrl . '&ADMCMD_prev=IGNORE&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=' . $backendUser->workspace;
$backendDomain = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
$splitPreviewTsConfig = BackendUtility::getModTSconfig($this->pageId, 'workspaces.splitPreviewModes');
$splitPreviewModes = GeneralUtility::trimExplode(',', $splitPreviewTsConfig['value']);
$allPreviewModes = array('slider', 'vbox', 'hbox');
if (!array_intersect($splitPreviewModes, $allPreviewModes)) {
$splitPreviewModes = $allPreviewModes;
}
$wsList = $wsService->getAvailableWorkspaces();
$activeWorkspace = $backendUser->workspace;
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Workspaces/Preview');
$this->pageRenderer->addInlineSetting('Workspaces', 'SplitPreviewModes', $splitPreviewModes);
$this->pageRenderer->addInlineSetting('Workspaces', 'token', FormProtectionFactory::get('backend')->generateToken('extDirect'));
$cssFile = 'EXT:workspaces/Resources/Public/Css/preview.css';
$cssFile = GeneralUtility::getFileAbsFileName($cssFile);
$this->pageRenderer->addCssFile(PathUtility::getAbsoluteWebPath($cssFile));
$backendUser->setAndSaveSessionData('workspaces.backend_domain', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'));
$logoPath = GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/Images/typo3-topbar@2x.png');
list($logoWidth, $logoHeight) = @getimagesize($logoPath);
// High-resolution?
$logoWidth = $logoWidth / 2;
$logoHeight = $logoHeight / 2;
$this->view->assignMultiple(['logoUrl' => PathUtility::getAbsoluteWebPath($logoPath), 'logoLink' => TYPO3_URL_GENERAL, 'logoWidth' => $logoWidth, 'logoHeight' => $logoHeight, 'liveUrl' => $liveUrl, 'wsUrl' => $wsUrl, 'wsSettingsUrl' => $wsSettingsUrl, 'backendDomain' => $backendDomain, 'activeWorkspace' => $wsList[$activeWorkspace], 'splitPreviewModes' => $splitPreviewModes, 'firstPreviewMode' => current($splitPreviewModes), 'enablePreviousStageButton' => !$this->isInvalidStage($previousStage), 'enableNextStageButton' => !$this->isInvalidStage($nextStage), 'enableDiscardStageButton' => !$this->isInvalidStage($nextStage) || !$this->isInvalidStage($previousStage), 'nextStage' => $nextStage['title'], 'nextStageId' => $nextStage['uid'], 'prevStage' => $previousStage['title'], 'prevStageId' => $previousStage['uid']]);
foreach ($this->getAdditionalResourceService()->getLocalizationResources() as $localizationResource) {
$this->pageRenderer->addInlineLanguageLabelFile($localizationResource);
}
}
示例11: includeLegacyBackendItems
/**
* Add hooks from the additional backend items to load certain things for the main backend.
* This was previously called from the global scope from backend.php.
*/
protected function includeLegacyBackendItems()
{
$TYPO3backend = $this;
// Include extensions which may add css, javascript or toolbar items
if (is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
include_once $additionalBackendItem;
}
}
// Process ExtJS module js and css
if (is_array($GLOBALS['TBE_MODULES']['_configuration'])) {
foreach ($GLOBALS['TBE_MODULES']['_configuration'] as $moduleConfig) {
if (is_array($moduleConfig['cssFiles'])) {
foreach ($moduleConfig['cssFiles'] as $cssFileName => $cssFile) {
$cssFile = GeneralUtility::getFileAbsFileName($cssFile);
$cssFile = PathUtility::getAbsoluteWebPath($cssFile);
$TYPO3backend->addCssFile($cssFileName, $cssFile);
}
}
if (is_array($moduleConfig['jsFiles'])) {
foreach ($moduleConfig['jsFiles'] as $jsFile) {
$jsFile = GeneralUtility::getFileAbsFileName($jsFile);
$jsFile = PathUtility::getAbsoluteWebPath($jsFile);
$TYPO3backend->addJavascriptFile($jsFile);
}
}
}
}
}
示例12: loadRequireJs
/**
* Call function if you need the requireJS library
* this automatically adds the JavaScript path of all loaded extensions in the requireJS path option
* so it resolves names like TYPO3/CMS/MyExtension/MyJsFile to EXT:MyExtension/Resources/Public/JavaScript/MyJsFile.js
* when using requireJS
*
* @return void
*/
public function loadRequireJs()
{
// load all paths to map to package names / namespaces
if (empty($this->requireJsConfig)) {
// In order to avoid browser caching of JS files, adding a GET parameter to the files loaded via requireJS
if (GeneralUtility::getApplicationContext()->isDevelopment()) {
$this->requireJsConfig['urlArgs'] = 'bust=' . $GLOBALS['EXEC_TIME'];
} else {
$this->requireJsConfig['urlArgs'] = 'bust=' . GeneralUtility::hmac(TYPO3_version . PATH_site);
}
$corePath = ExtensionManagementUtility::extPath('core', 'Resources/Public/JavaScript/Contrib/');
$corePath = PathUtility::getAbsoluteWebPath($corePath);
// first, load all paths for the namespaces, and configure contrib libs.
$this->requireJsConfig['paths'] = array('jquery-ui' => $corePath . 'jquery-ui', 'datatables' => $corePath . 'jquery.dataTables', 'nprogress' => $corePath . 'nprogress', 'moment' => $corePath . 'moment', 'cropper' => $corePath . 'cropper.min', 'imagesloaded' => $corePath . 'imagesloaded.pkgd.min', 'bootstrap' => $corePath . 'bootstrap/bootstrap', 'twbs/bootstrap-datetimepicker' => $corePath . 'bootstrap-datetimepicker', 'autosize' => $corePath . 'autosize', 'taboverride' => $corePath . 'taboverride.min', 'twbs/bootstrap-slider' => $corePath . 'bootstrap-slider.min', 'jquery/autocomplete' => $corePath . 'jquery.autocomplete');
// get all extensions that are loaded
$loadedExtensions = ExtensionManagementUtility::getLoadedExtensionListArray();
foreach ($loadedExtensions as $packageName) {
$fullJsPath = 'EXT:' . $packageName . '/Resources/Public/JavaScript/';
$fullJsPath = GeneralUtility::getFileAbsFileName($fullJsPath);
$fullJsPath = PathUtility::getAbsoluteWebPath($fullJsPath);
$fullJsPath = rtrim($fullJsPath, '/');
if ($fullJsPath) {
$this->requireJsConfig['paths']['TYPO3/CMS/' . GeneralUtility::underscoredToUpperCamelCase($packageName)] = $fullJsPath;
}
}
// check if additional AMD modules need to be loaded if a single AMD module is initialized
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules'])) {
$this->addInlineSettingArray('RequireJS.PostInitializationModules', $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['RequireJS']['postInitializationModules']);
}
}
$this->addRequireJs = true;
}
示例13: renderListMenu
/**
* Render a list of items as a nicely formated definition list including a
* link, icon, title and description.
* The keys of a single item are:
* - title: Title of the item
* - link: Link to the task
* - icon: Path to the icon or Icon as HTML if it begins with <img
* - description: Description of the task, using htmlspecialchars()
* - descriptionHtml: Description allowing HTML tags which will override the
* description
*
* @param array $items List of items to be displayed in the definition list.
* @param bool $mainMenu Set it to TRUE to render the main menu
* @return string Fefinition list
*/
public function renderListMenu($items, $mainMenu = false)
{
$content = $section = '';
$count = 0;
// Change the sorting of items to the user's one
if ($mainMenu) {
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Taskcenter/Taskcenter');
$userSorting = unserialize($this->getBackendUser()->uc['taskcenter']['sorting']);
if (is_array($userSorting)) {
$newSorting = array();
foreach ($userSorting as $item) {
if (isset($items[$item])) {
$newSorting[] = $items[$item];
unset($items[$item]);
}
}
$items = $newSorting + $items;
}
}
if (is_array($items) && !empty($items)) {
foreach ($items as $itemKey => $item) {
$title = htmlspecialchars($item['title']);
$icon = $additionalClass = $collapsedStyle = '';
// Check for custom icon
if (!empty($item['icon'])) {
if (strpos($item['icon'], '<img ') === false) {
$absIconPath = GeneralUtility::getFileAbsFileName($item['icon']);
// If the file indeed exists, assemble relative path to it
if (file_exists($absIconPath)) {
$icon = '../' . str_replace(PATH_site, '', $absIconPath);
$icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />';
}
if (@is_file($icon)) {
$icon = '<img src="' . PathUtility::getAbsoluteWebPath($icon) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />';
}
} else {
$icon = $item['icon'];
}
}
$description = $item['descriptionHtml'] ?: '<p>' . nl2br(htmlspecialchars($item['description'])) . '</p>';
$id = $this->getUniqueKey($item['uid']);
$contentId = strtolower(str_replace('\\', '-', $id));
// Collapsed & expanded menu items
if (isset($this->getBackendUser()->uc['taskcenter']['states'][$id]) && $this->getBackendUser()->uc['taskcenter']['states'][$id]) {
$collapsed = true;
$collapseIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-view-list-expand', Icon::SIZE_SMALL)->render('inline');
} else {
$collapsed = false;
$collapseIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-view-list-collapse', Icon::SIZE_SMALL)->render('inline');
}
// Active menu item
$panelState = (string) $this->MOD_SETTINGS['function'] == $item['uid'] ? 'panel-active' : 'panel-default';
$content .= '<li id="el_' . $id . '">
<div id="' . $contentId . '" data-taskcenter-id="' . $id . '" class="panel ' . $panelState . '">
<div class="panel-heading">
<div class="panel-heading-right">
<a href="#task_content_' . $contentId . '" class="panel-header-collapse t3js-taskcenter-header-collapse" role="button" data-toggle="collapse" data-uid="' . $contentId . '" aria-expanded="' . ($collapsed ? 'false' : 'true') . '">
' . $collapseIcon . '
</a>
</div>
<div class="panel-heading-left">
<a href="' . $item['link'] . '" class="panel-title">
' . ($icon ? '<span class="panel-title-icon">' . $icon . '</span>' : '') . '
<span class="panel-title-name">' . $title . ' ' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-table-expand', Icon::SIZE_SMALL)->render('inline') . '</span>
</a>
</div>
</div>
<div id="task_content_' . $contentId . '" class="panel-collapse collapse t3js-taskcenter-collapse ' . ($collapsed ? '' : 'in') . '" aria-expanded="true">
<div class="panel-body">
' . $description . '
</div>
</div>
</div>
</li>';
$count++;
}
$navigationId = $mainMenu ? 'id="task-list"' : '';
$content = '<ul ' . $navigationId . ' class="list-unstyled">' . $content . '</ul>';
}
return $content;
}
示例14: loadCss
/**
* Load the necessary css
*
* This will only be done when the referenced record is available
*
* @return void
*/
protected function loadCss()
{
$cssFiles = array('Wizard/Form.css', 'Wizard/Wizard.css');
$baseUrl = ExtensionManagementUtility::extPath('form') . 'Resources/Public/CSS/';
// Load the wizards css
foreach ($cssFiles as $cssFile) {
$this->getPageRenderer()->addCssFile(PathUtility::getAbsoluteWebPath($baseUrl . $cssFile));
}
}
示例15: colorImage
/**
* Creates a color image selector
*
* @return string
*/
public function colorImage()
{
// Handling color-picker image if any:
if (!$this->imageError) {
if ($this->pickerImage) {
if (GeneralUtility::_POST('coords_x')) {
/** @var $image \TYPO3\CMS\Core\Imaging\GraphicalFunctions */
$image = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\GraphicalFunctions::class);
$this->colorValue = '#' . $this->getIndex($image->imageCreateFromFile($this->pickerImage), GeneralUtility::_POST('coords_x'), GeneralUtility::_POST('coords_y'));
}
$pickerFormImage = '
<p class="c-head">' . $this->getLanguageService()->getLL('colorpicker_fromImage', true) . '</p>
<input type="image" src="' . PathUtility::getAbsoluteWebPath($this->pickerImage) . '" name="coords" style="cursor:crosshair;" /><br />';
} else {
$pickerFormImage = '';
}
} else {
$pickerFormImage = '
<p class="c-head">' . htmlspecialchars($this->imageError) . '</p>';
}
return $pickerFormImage;
}