本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addJsFooterInlineCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addJsFooterInlineCode方法的具体用法?PHP PageRenderer::addJsFooterInlineCode怎么用?PHP PageRenderer::addJsFooterInlineCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::addJsFooterInlineCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddJsFooterInlineCode
/**
* test add JS inline for footer
*/
public function testAddJsFooterInlineCode()
{
$expectedReturnValue = 'var x = "testvar"';
$this->fixture->addJsFooterInlineCode('test', 'var x = "testvar"');
$out = $this->fixture->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_FOOTER);
$this->assertContains($expectedReturnValue, $out);
}
示例2: addJSInlineCode
/**
* Add JS inline code
*
* @param string $name
* @param string $block
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $position
*/
public function addJSInlineCode($name, $block, $compress = true, $forceOnTop = false, $position = 'footer')
{
if ($position === 'header') {
$this->pageRenderer->addJsInlineCode($name, $block, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
}
}
示例3: render
/**
* Render
*
* @param string $block
*/
public function render()
{
$block = $this->renderChildren();
if ($this->isCached()) {
$this->pageRenderer->addJsFooterInlineCode($this->arguments['name'], $block, $this->arguments['compress'], $this->arguments['forceOnTop']);
} else {
// additionalFooterData not possible in USER_INT
$GLOBALS['TSFE']->additionalFooterData[md5($this->arguments['name'])] = GeneralUtility::wrapJS($block);
}
}
示例4: renderContent
/**
* Returns the fully rendered view
*
* @return string
*/
public function renderContent()
{
$this->setupPage();
$this->pageRenderer->setTitle($this->title);
$this->loadJavaScripts();
$this->setJavaScriptCodeArray();
$this->loadStylesheets();
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
if ($this->moduleId) {
$this->view->assign('moduleId', $this->moduleId);
}
if ($this->moduleName) {
$this->view->assign('moduleName', $this->moduleName);
}
$renderedPage = $this->pageRenderer->render(PageRenderer::PART_HEADER);
$renderedPage .= $this->view->render();
$this->pageRenderer->addJsFooterInlineCode('updateSignals', BackendUtility::getUpdateSignalCode());
$renderedPage .= $this->pageRenderer->render(PageRenderer::PART_FOOTER);
return $renderedPage;
}
示例5: getAjaxFunction
/**
* Returns JS callback for the given action
*
* @param null $action
* @param array $arguments
* @param null $controller
* @param null $extensionName
* @param null $pluginName
* @param string $format
* @param string $section
* @return string
*/
public function getAjaxFunction($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $section = 'footer')
{
// current element needs to have additional logic...
$this->hijaxEventDispatcher->setIsHijaxElement(true);
$request = $this->mvcDispatcher->getCurrentRequest();
if ($request) {
if ($action === NULL) {
$action = $request->getControllerActionName();
}
if ($controller === NULL) {
$controller = $request->getControllerName();
}
if ($extensionName === NULL) {
$extensionName = $request->getControllerExtensionName();
}
if ($pluginName === NULL && TYPO3_MODE === 'FE') {
$pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
}
if ($pluginName === NULL) {
$pluginName = $request->getPluginName();
}
}
$settings = array('extension' => $extensionName, 'plugin' => $pluginName, 'controller' => $controller, 'format' => $format ? $format : 'html', 'action' => $action, 'arguments' => $arguments, 'settingsHash' => $this->mvcDispatcher->getCurrentListener() ? $this->mvcDispatcher->getCurrentListener()->getId() : '', 'namespace' => $extensionName && $pluginName ? $this->extensionService->getPluginNamespace($extensionName, $pluginName) : '');
$functionName = 'extbaseHijax_' . md5(serialize($settings));
$content = "; {$functionName}=function(settings, pendingElement, loaders) {";
foreach ($settings as $k => $v) {
$content .= "if (typeof settings.{$k} == 'undefined') settings.{$k}=" . json_encode($v) . ";";
}
$content .= "return jQuery.hijax(settings, pendingElement, loaders);};";
if ($this->isCached()) {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterInlineCode(md5($content), $content, FALSE, TRUE);
} else {
$this->pageRenderer->addJsInlineCode(md5($content), $content, FALSE, TRUE);
}
} else {
// additionalFooterData not possible in USER_INT
$GLOBALS['TSFE']->additionalHeaderData[md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
}
return $functionName;
}
示例6: setValue
/**
* set the value
*
* @param string $value value
* @return \Ameos\AmeosForm\Elements\ElementAbstract this
*/
public function setValue($value)
{
if ($value == 0) {
$value = '';
}
parent::setValue($value);
if ($value != '') {
$this->pageRenderer->addJsFooterInlineCode('setvalue-datepicker-' . $this->getName() . '-' . $value, '
if(document.getElementById("' . $this->getHtmlId() . '-datepicker")) {
document.getElementById("' . $this->getHtmlId() . '-datepicker").value = moment(' . $value . ', "X").format("' . $this->configuration['format'] . '");
}
');
} else {
$this->pageRenderer->addJsFooterInlineCode('setvalue-datepicker-' . $this->getName() . '-' . $value, '
if(document.getElementById("' . $this->getHtmlId() . '-datepicker")) {
document.getElementById("' . $this->getHtmlId() . '-datepicker").value = "";
}
');
}
return $this;
}
示例7: render
/**
*
* @param string $name
* @param string $compress
* @param string $forceOnTop
* @return NULL
*/
public function render($name, $compress = FALSE, $forceOnTop = FALSE)
{
$block = $this->renderChildren();
$this->pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
return NULL;
}
示例8: render
/**
* @param string $src
* @param string $type
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $allWrap
* @param boolean $excludeFromConcatenation
* @param string $section
* @param boolean $preventMarkupUpdateOnAjaxLoad
* @param boolean $moveToExternalFile
* @param boolean $noCache
* @param string $name
*
* @return string
*/
public function render($src = "", $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE, $section = 'footer', $preventMarkupUpdateOnAjaxLoad = false, $moveToExternalFile = false, $noCache = false, $name = '')
{
$content = $this->renderChildren();
if ($this->ajaxDispatcher->getIsActive()) {
if ($preventMarkupUpdateOnAjaxLoad) {
$this->ajaxDispatcher->setPreventMarkupUpdateOnAjaxLoad(true);
}
// need to just echo the code in ajax call
if (!$src) {
if ($compress) {
$content = $this->compressScript($content);
}
return \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
return '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
} else {
if ($this->isCached()) {
if ($noCache) {
if ($src) {
$content = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
} else {
if ($compress) {
$content = $this->compressScript($content);
}
$content = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
}
$tslibFE = GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Tslib\\FE\\Hook');
/* @var $tslibFE \EssentialDots\ExtbaseHijax\Tslib\FE\Hook */
if ($section == 'footer') {
$tslibFE->addNonCacheableFooterCode($name ? $name : md5($content), $content);
} else {
$tslibFE->addNonCacheableHeaderCode($name ? $name : md5($content), $content);
}
return '';
} else {
if (!$src && $moveToExternalFile) {
$src = 'typo3temp' . DIRECTORY_SEPARATOR . 'extbase_hijax' . DIRECTORY_SEPARATOR . md5($content) . '.js';
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $src, $content);
if ($GLOBALS['TSFE']) {
if ($GLOBALS['TSFE']->baseUrl) {
$src = $GLOBALS['TSFE']->baseUrl . $src;
} elseif ($GLOBALS['TSFE']->absRefPrefix) {
$src = $GLOBALS['TSFE']->absRefPrefix . $src;
}
}
}
if (!$src) {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
}
} else {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
} else {
$this->pageRenderer->addJsFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
}
}
}
} else {
// additionalFooterData not possible in USER_INT
if (!$src) {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
}
}
return '';
}