本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addCssInlineBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addCssInlineBlock方法的具体用法?PHP PageRenderer::addCssInlineBlock怎么用?PHP PageRenderer::addCssInlineBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::addCssInlineBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Main function generating the BE scaffolding
*
* @return void
*/
public function render()
{
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$logo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Views\\LogoView');
$logo->setLogo('gfx/typo3logo_mini.png');
// Create backend scaffolding
$backendScaffolding = '
<div id="typo3-top-container" class="x-hide-display">
<div id="typo3-logo">' . $logo->render() . '</div>
<div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div>
</div>';
/******************************************************
* Now put the complete backend document together
******************************************************/
foreach ($this->cssFiles as $cssFileName => $cssFile) {
$this->pageRenderer->addCssFile($cssFile);
// Load addditional css files to overwrite existing core styles
if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
$this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
}
}
if (!empty($this->css)) {
$this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
}
foreach ($this->jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($jsFile);
}
$this->generateJavascript();
$this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js, FALSE);
$this->loadResourcesForRegisteredNavigationComponents();
// Add state provider
$GLOBALS['TBE_TEMPLATE']->setExtDirectStateProvider();
$states = $GLOBALS['BE_USER']->uc['BackendComponents']['States'];
// Save states in BE_USER->uc
$extOnReadyCode = '
Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
key: "BackendComponents.States",
autoRead: false
}));
';
if ($states) {
$extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
}
$extOnReadyCode .= '
TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
if (typeof console === "undefined") {
console = TYPO3.Backend.DebugConsole;
}
TYPO3.ContextHelpWindow.init();';
$this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
// Set document title:
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version;
$this->content = $backendScaffolding;
// Renders the module page
$this->content = $GLOBALS['TBE_TEMPLATE']->render($title, $this->content);
$hookConfiguration = array('content' => &$this->content);
$this->executeHook('renderPostProcess', $hookConfiguration);
echo $this->content;
}
示例2: testAddCssInlineBlockForceOnTop
/**
* test add CSS inline and force on top
*/
public function testAddCssInlineBlockForceOnTop()
{
$expectedReturnValue = '/*general1*/' . LF . 'h1 {margin:20px;}' . LF . '/*general*/' . LF . 'body {margin:20px;}';
$this->fixture->addCssInlineBlock('general', 'body {margin:20px;}');
$this->fixture->addCssInlineBlock('general1', 'h1 {margin:20px;}', NULL, TRUE);
$out = $this->fixture->render();
$this->assertContains($expectedReturnValue, $out);
}
示例3: render
/**
* Main function generating the BE scaffolding
*
* @return void
*/
public function render()
{
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');
// Render the TYPO3 logo in the left corner
$logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: 'sysext/backend/Resources/Public/Images/typo3-topbar@2x.png';
$logoPath = GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
list($logoWidth, $logoHeight) = @getimagesize($logoPath);
// High-resolution?
if (strpos($logoUrl, '@2x.') !== false) {
$logoWidth = $logoWidth / 2;
$logoHeight = $logoHeight / 2;
}
$view->assign('logoUrl', $logoUrl);
$view->assign('logoWidth', $logoWidth);
$view->assign('logoHeight', $logoHeight);
$view->assign('logoLink', TYPO3_URL_GENERAL);
$view->assign('applicationVersion', TYPO3_version);
$view->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
$view->assign('moduleMenu', $this->generateModuleMenu());
$view->assign('toolbar', $this->renderToolbar());
/******************************************************
* Now put the complete backend document together
******************************************************/
foreach ($this->cssFiles as $cssFileName => $cssFile) {
$this->pageRenderer->addCssFile($cssFile);
// Load additional css files to overwrite existing core styles
if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
$this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
}
}
if (!empty($this->css)) {
$this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
}
foreach ($this->jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($jsFile);
}
$this->generateJavascript();
$this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js, false);
$this->loadResourcesForRegisteredNavigationComponents();
// Add state provider
$this->getDocumentTemplate()->setExtDirectStateProvider();
$states = $this->getBackendUser()->uc['BackendComponents']['States'];
// Save states in BE_USER->uc
$extOnReadyCode = '
Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
key: "BackendComponents.States",
autoRead: false
}));
';
if ($states) {
$extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
}
$extOnReadyCode .= '
TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
if (typeof console === "undefined") {
console = TYPO3.Backend.DebugConsole;
}';
$this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
// Set document title:
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 CMS ' . TYPO3_version . ']' : 'TYPO3 CMS ' . TYPO3_version;
// Renders the module page
$this->content = $this->getDocumentTemplate()->render($title, $view->render());
$hookConfiguration = array('content' => &$this->content);
$this->executeHook('renderPostProcess', $hookConfiguration);
}
示例4: docStyle
/**
* Outputting document style
*
* @return string HTML style section/link tags
*/
public function docStyle()
{
// Implode it all:
$inDocStyles = implode(LF, $this->inDocStylesArray);
// Reset styles so they won't be added again in insertStylesAndJS()
$this->inDocStylesArray = array();
if ($this->styleSheetFile) {
$this->pageRenderer->addCssFile($this->styleSheetFile);
}
if ($this->styleSheetFile2) {
$this->pageRenderer->addCssFile($this->styleSheetFile2);
}
if ($inDocStyles !== '') {
$this->pageRenderer->addCssInlineBlock('inDocStyles', $inDocStyles . LF . '/*###POSTCSSMARKER###*/');
}
if ($this->styleSheetFile_post) {
$this->pageRenderer->addCssFile($this->styleSheetFile_post);
}
}
示例5: docStyle
/**
* Outputting document style
*
* @return string HTML style section/link tags
* @todo Define visibility
*/
public function docStyle()
{
// Request background image:
if ($this->backGroundImage) {
$this->inDocStylesArray[] = ' BODY { background-image: url(' . $this->backPath . $this->backGroundImage . '); }';
}
// Add inDoc styles variables as well:
$this->inDocStylesArray[] = $this->inDocStyles;
$this->inDocStylesArray[] = $this->inDocStyles_TBEstyle;
// Implode it all:
$inDocStyles = implode(LF, $this->inDocStylesArray);
// Reset styles so they won't be added again in insertStylesAndJS()
$this->inDocStylesArray = array();
$this->inDocStyles = '';
$this->inDocStyles_TBEstyle = '';
if ($this->styleSheetFile) {
$this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile);
}
if ($this->styleSheetFile2) {
$this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile2);
}
$this->pageRenderer->addCssInlineBlock('inDocStyles', $inDocStyles . LF . '/*###POSTCSSMARKER###*/');
if ($this->styleSheetFile_post) {
$this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile_post);
}
}
示例6: render
/**
* Main function generating the BE scaffolding
*
* @return void
*/
public function render()
{
// Needed for the hooks below, as they previously were located in the global scope
// Caution: do not use the global variable anymore but only reference "$this", or use the "renderPreProcess"
$GLOBALS['TYPO3backend'] = $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) {
$files = array(GeneralUtility::getFileAbsFileName($cssFile));
$files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
$this->addCssFile($cssFileName, '../' . $files[0]);
}
}
if (is_array($moduleConfig['jsFiles'])) {
foreach ($moduleConfig['jsFiles'] as $jsFile) {
$files = array(GeneralUtility::getFileAbsFileName($jsFile));
$files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
$this->addJavascriptFile('../' . $files[0]);
}
}
}
}
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');
// Render the TYPO3 logo in the left corner
$logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: 'sysext/backend/Resources/Public/Images/typo3-topbar@2x.png';
$logoPath = GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
list($logoWidth, $logoHeight) = @getimagesize($logoPath);
// High-resolution?
if (strpos($logoUrl, '@2x.') !== FALSE) {
$logoWidth = $logoWidth / 2;
$logoHeight = $logoHeight / 2;
}
$view->assign('logoUrl', $logoUrl);
$view->assign('logoWidth', $logoWidth);
$view->assign('logoHeight', $logoHeight);
$view->assign('logoLink', TYPO3_URL_GENERAL);
$view->assign('applicationVersion', TYPO3_version);
$view->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
$view->assign('moduleMenu', $this->generateModuleMenu());
$view->assign('toolbar', $this->renderToolbar());
/******************************************************
* Now put the complete backend document together
******************************************************/
foreach ($this->cssFiles as $cssFileName => $cssFile) {
$this->pageRenderer->addCssFile($cssFile);
// Load additional css files to overwrite existing core styles
if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
$this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
}
}
if (!empty($this->css)) {
$this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
}
foreach ($this->jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($jsFile);
}
$this->generateJavascript();
$this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js, FALSE);
$this->loadResourcesForRegisteredNavigationComponents();
// Add state provider
$this->getDocumentTemplate()->setExtDirectStateProvider();
$states = $this->getBackendUser()->uc['BackendComponents']['States'];
// Save states in BE_USER->uc
$extOnReadyCode = '
Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
key: "BackendComponents.States",
autoRead: false
}));
';
if ($states) {
$extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
}
$extOnReadyCode .= '
TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
if (typeof console === "undefined") {
console = TYPO3.Backend.DebugConsole;
}';
$this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
// Set document title:
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 CMS ' . TYPO3_version . ']' : 'TYPO3 CMS ' . TYPO3_version;
// Renders the module page
$this->content = $this->getDocumentTemplate()->render($title, $view->render());
$hookConfiguration = array('content' => &$this->content);
$this->executeHook('renderPostProcess', $hookConfiguration);
echo $this->content;
//.........这里部分代码省略.........
示例7: addCssInlineBlock
/**
* @param $name
* @param $block
* @param bool $compress
* @param bool $forceOnTop
* @return void
*/
public function addCssInlineBlock($name, $block, $compress = false, $forceOnTop = false)
{
$this->pageRenderer->addCssInlineBlock($name, $block, $compress, $forceOnTop);
}