本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addJsFooterFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addJsFooterFile方法的具体用法?PHP PageRenderer::addJsFooterFile怎么用?PHP PageRenderer::addJsFooterFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::addJsFooterFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @constuctor
*
* @param string $absolutename absolutename
* @param string $name name
* @param array $configuration configuration
* @param \Ameos\AmeosForm\Form $form form
*/
public function __construct($absolutename, $name, $configuration = [], $form)
{
parent::__construct($absolutename, $name, $configuration, $form);
$this->pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer');
if (!isset($this->configuration['format'])) {
$this->configuration['format'] = 'D MMM YYYY';
}
$this->pageRenderer->addCssFile('/typo3conf/ext/ameos_form/Resources/Public/Pikaday/css/pikaday.css');
$this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Momentjs/moment.js');
$this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Pikaday/pikaday.js');
$this->pageRenderer->addJsFooterFile('/typo3conf/ext/ameos_form/Resources/Public/Elements/datepicker.js');
$this->pageRenderer->addJsFooterInlineCode('init-datepicker-' . $name, '
var i18n = {
previousMonth: "' . LocalizationUtility::translate('previousMonth', 'AmeosForm') . '",
nextMonth: "' . LocalizationUtility::translate('nextMonth', 'AmeosForm') . '",
months : {
1: "' . LocalizationUtility::translate('months.1', 'AmeosForm') . '",
2: "' . LocalizationUtility::translate('months.2', 'AmeosForm') . '",
3: "' . LocalizationUtility::translate('months.3', 'AmeosForm') . '",
4: "' . LocalizationUtility::translate('months.4', 'AmeosForm') . '",
5: "' . LocalizationUtility::translate('months.5', 'AmeosForm') . '",
6: "' . LocalizationUtility::translate('months.6', 'AmeosForm') . '",
7: "' . LocalizationUtility::translate('months.7', 'AmeosForm') . '",
8: "' . LocalizationUtility::translate('months.8', 'AmeosForm') . '",
9: "' . LocalizationUtility::translate('months.9', 'AmeosForm') . '",
10: "' . LocalizationUtility::translate('months.10', 'AmeosForm') . '",
11: "' . LocalizationUtility::translate('months.11', 'AmeosForm') . '",
12: "' . LocalizationUtility::translate('months.12', 'AmeosForm') . '"
},
weekdays : {
1: "' . LocalizationUtility::translate('weekdays.1', 'AmeosForm') . '",
2: "' . LocalizationUtility::translate('weekdays.2', 'AmeosForm') . '",
3: "' . LocalizationUtility::translate('weekdays.3', 'AmeosForm') . '",
4: "' . LocalizationUtility::translate('weekdays.4', 'AmeosForm') . '",
5: "' . LocalizationUtility::translate('weekdays.5', 'AmeosForm') . '",
6: "' . LocalizationUtility::translate('weekdays.6', 'AmeosForm') . '",
7: "' . LocalizationUtility::translate('weekdays.7', 'AmeosForm') . '"
},
weekdaysShort : {
1: "' . LocalizationUtility::translate('weekdaysShort.1', 'AmeosForm') . '",
2: "' . LocalizationUtility::translate('weekdaysShort.2', 'AmeosForm') . '",
3: "' . LocalizationUtility::translate('weekdaysShort.3', 'AmeosForm') . '",
4: "' . LocalizationUtility::translate('weekdaysShort.4', 'AmeosForm') . '",
5: "' . LocalizationUtility::translate('weekdaysShort.5', 'AmeosForm') . '",
6: "' . LocalizationUtility::translate('weekdaysShort.6', 'AmeosForm') . '",
7: "' . LocalizationUtility::translate('weekdaysShort.7', 'AmeosForm') . '"
}
};
initDatepicker("' . $this->getHtmlId() . '", "' . $this->configuration['format'] . '", i18n);
');
}
示例2: testAddJsFooterFile
/**
* test add JS file for footer
*/
public function testAddJsFooterFile()
{
$expectedRegExp = '#<script src="fileadmin/test\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
$this->fixture->addJsFooterFile('fileadmin/test.js');
$out = $this->fixture->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_FOOTER);
$this->assertRegExp($expectedRegExp, $out);
}
示例3: addJSFile
/**
* Add a JS File to the header
*
* @param string $file
* @param string $type
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $allWrap
* @param string $position
* @return void
*/
public function addJSFile($file, $position = 'footer', $type = 'text/javascript', $compress = true, $forceOnTop = false, $allWrap = '')
{
$filePath = GeneralUtility::isFirstPartOfStr(strtolower($file), 'http') ? $file : $this->fileSystemDiv->getFileRelFileName($file);
if ($position === 'footer') {
$this->pageRenderer->addJsFooterFile($filePath, $type, $compress, $forceOnTop, $allWrap);
} else {
$this->pageRenderer->addJsFile($filePath, $type, $compress, $forceOnTop, $allWrap);
}
}
示例4: render
/**
* Render the URI to the resource. The filename is used from child content.
*
* @param string $file The relative path of the resource (relative to Public resource directory of the extension).
*/
public function render($file = NULL)
{
if (!$this->arguments['extensionName']) {
$this->arguments['extensionName'] = $this->controllerContext->getRequest()->getControllerExtensionName();
}
$uri = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($this->arguments['extensionName']) . $this->getResourcesPathAndFilename($file);
$uri = GeneralUtility::getFileAbsFileName($uri);
$uri = substr($uri, strlen(PATH_site));
switch ($this->arguments['where']) {
case 'footer':
$this->pageRenderer->addJsFooterFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
case 'footerLibs':
$this->pageRenderer->addJsFooterLibrary($this->arguments['key'], $uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
default:
$this->pageRenderer->addJsFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
}
}
示例5: 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 '';
}