Commit 412e2fdf authored by Alexander Bohn's avatar Alexander Bohn

[RELEASE] v3.0.0

make flexslider typo3 8 ready
parents b2fa365e b5484657
......@@ -93,6 +93,18 @@ class Div {
return $GLOBALS['TSFE']->tmpl->getFileName($file);
}
public static function getPageRenderer(){
if (version_compare(TYPO3_version, '8.0.0', '>='))
{
$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);
}
else
{
$pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
}
return $pageRenderer;
}
/**
* Checks a passed CSS or JS file and adds it to the Frontend.
*
......@@ -105,18 +117,18 @@ class Div {
$mediaTypeSplit = strrchr($file, '.');
// Get file reference
$resolved = self::getFileResource($file);
$pageRenderer=self::getPageRenderer();
if ($resolved) {
// JavaScript processing
if ($mediaTypeSplit == '.js') {
($moveToFooter)
? $GLOBALS['TSFE']->getPageRenderer()->addJsFooterFile($resolved)
: $GLOBALS['TSFE']->getPageRenderer()->addJsFile($resolved);
? $pageRenderer->addJsFooterFile($resolved)
: $pageRenderer->addJsFile($resolved);
// Stylesheet processing
} elseif ($mediaTypeSplit == '.css') {
/** \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
$GLOBALS['TSFE']->getPageRenderer()->addCssFile($resolved);
$pageRenderer->addCssFile($resolved);
}
}
}
......@@ -133,9 +145,10 @@ class Div {
public static function addJsInline($code, $name, $moveToFooter = FALSE) {
if ($code) {
//$code = '<script type="text/javascript">'.$code.'</script>';
$pageRenderer=self::getPageRenderer();
($moveToFooter)
? $GLOBALS['TSFE']->getPageRenderer()->addJsFooterInlineCode($name, $code)
: $GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode($name, $code);
? $pageRenderer->addJsFooterInlineCode($name, $code)
: $pageRenderer->addJsInlineCode($name, $code);
}
}
......@@ -152,8 +165,9 @@ class Div {
$code = '.typo3-message .message-header{padding: 10px 10px 0 30px;font-size:0.9em;}';
$code .= '.typo3-message .message-body{padding: 10px;font-size:0.9em;}';
$GLOBALS['TSFE']->getPageRenderer()->addCssFile(ExtensionManagementUtility::siteRelPath('t3skin') . 'Resources/Public/Css/visual/element_message.css');
$GLOBALS['TSFE']->getPageRenderer()->addCssInlineBlock('flashmessage',$code);
$pageRenderer=self::getPageRenderer();
$pageRenderer->addCssFile(ExtensionManagementUtility::siteRelPath('t3skin') . 'Resources/Public/Css/visual/element_message.css');
$pageRenderer->addCssInlineBlock('flashmessage',$code);
$flashMessage = GeneralUtility::makeInstance('TYPO3\CMS\Core\Messaging\FlashMessage', $message, $title, $type);
return $flashMessage->render();
......
......@@ -10,8 +10,29 @@ $configuration = EmConfiguration::getConfiguration();
$pathLL = 'LLL:EXT:flexslider/Resources/Private/Language/locallang_db.xml:';
$TCA['tx_flexslider_domain_model_flexslider'] = array(
'ctrl' => $TCA['tx_flexslider_domain_model_flexslider']['ctrl'],
return [
'ctrl' => array(
'title' => 'LLL:EXT:flexslider/Resources/Private/Language/locallang_db.xml:tx_flexslider_domain_model_flexslider',
'label' => 'name',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'sortby' => 'sorting',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'iconfile' => 'EXT: flexslider/Resources/Public/Icons/tx_flexslider_domain_model_flexslider.gif'
),
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, title, subtitle, image, link, caption',
),
......@@ -185,7 +206,7 @@ $TCA['tx_flexslider_domain_model_flexslider'] = array(
),
),
),
);
];
/**
......@@ -194,7 +215,7 @@ $TCA['tx_flexslider_domain_model_flexslider'] = array(
// Extend the subtitle field, if the corresponding value in EM Config is set.
if ($configuration['extendSubtitleByRTE']) {
$TCA['tx_flexslider_domain_model_flexslider']['columns']['subtitle']['config']['wizards'] = array(
$GLOBALS['TCA']['tx_flexslider_domain_model_flexslider']['columns']['subtitle']['config']['wizards'] = array(
'RTE' => array(
'icon' => 'wizard_rte2.gif',
'notNewRecords'=> 1,
......@@ -204,10 +225,10 @@ if ($configuration['extendSubtitleByRTE']) {
'type' => 'script'
),
);
$TCA['tx_flexslider_domain_model_flexslider']['columns']['subtitle']['defaultExtras'] = 'richtext[]';
$TCA['tx_flexslider_domain_model_flexslider']['types']['1']['showitem'] = str_replace(
$GLOBALS['TCA']['tx_flexslider_domain_model_flexslider']['columns']['subtitle']['defaultExtras'] = 'richtext[]';
$GLOBALS['TCA']['tx_flexslider_domain_model_flexslider']['types']['1']['showitem'] = str_replace(
'subtitle',
'subtitle;;;richtext:rte_transform[mode=ts_css]',
$TCA['tx_flexslider_domain_model_flexslider']['types']['1']['showitem']
$GLOBALS['TCA']['tx_flexslider_domain_model_flexslider']['types']['1']['showitem']
);
}
<![CDATA[ jQuery(window).load(function() { ]]>
jQuery('#fs-{f:if(condition: data.pi_flexform, then: data.uid, else: altUid)}.flexslider').flexslider(
<![CDATA[{]]>
animation: "{settings.animation}",
slideDirection: "{settings.slideDirection}",
slideshow: <f:if condition="{settings.slideshow} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
slideshowSpeed: <f:if condition="{settings.slideshowSpeed} > 0"><f:then>{settings.slideshowSpeed}</f:then><f:else>7000</f:else></f:if>,
animationDuration: <f:if condition="{settings.animationDuration} > 0"><f:then>{settings.animationDuration}</f:then><f:else>600</f:else></f:if>,
controlNav: <f:if condition="{settings.controlNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
directionNav: <f:if condition="{settings.directionNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
keyboardNav: <f:if condition="{settings.keyboardNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
mousewheel: <f:if condition="{settings.mousewheel} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
prevText: "<f:translate key="prevText">Prev</f:translate>",
nextText: "<f:translate key="nextText">Next</f:translate>",
pausePlay: <f:if condition="{settings.pausePlay} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
pauseText: "<f:translate key="pauseText">Pause</f:translate>",
playText: "<f:translate key="playText">Play</f:translate>",
randomize: <f:if condition="{settings.randomize} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
animationLoop: <f:if condition="{settings.animationLoop} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
pauseOnHover: <f:if condition="{settings.pauseOnHover} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>
<![CDATA[
});
});
]]>
\ No newline at end of file
<f:format.raw value="jQuery(window).load(function() {" />
jQuery('#fs-{f:if(condition: data.pi_flexform, then: data.uid, else: altUid)}.flexslider').flexslider(
<f:format.raw value="{" />
animation: "{settings.animation}",
slideDirection: "{settings.slideDirection}",
slideshow: <f:if condition="{settings.slideshow} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
slideshowSpeed: <f:if condition="{settings.slideshowSpeed} > 0"><f:then>{settings.slideshowSpeed}</f:then><f:else>7000</f:else></f:if>,
animationDuration: <f:if condition="{settings.animationDuration} > 0"><f:then>{settings.animationDuration}</f:then><f:else>600</f:else></f:if>,
controlNav: <f:if condition="{settings.controlNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
directionNav: <f:if condition="{settings.directionNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
keyboardNav: <f:if condition="{settings.keyboardNav} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
mousewheel: <f:if condition="{settings.mousewheel} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
prevText: "<f:translate key="prevText">Prev</f:translate>",
nextText: "<f:translate key="nextText">Next</f:translate>",
pausePlay: <f:if condition="{settings.pausePlay} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
pauseText: "<f:translate key="pauseText">Pause</f:translate>",
playText: "<f:translate key="playText">Play</f:translate>",
randomize: <f:if condition="{settings.randomize} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
animationLoop: <f:if condition="{settings.animationLoop} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>,
pauseOnHover: <f:if condition="{settings.pauseOnHover} > 0"><f:then>true</f:then><f:else>false</f:else></f:if>
<f:format.raw value="});});" />
......@@ -14,7 +14,7 @@ $EM_CONF[$_EXTKEY] = array(
'author_company' => 'SOTA Studio',
'constraints' => array(
'depends' => array(
'typo3' => '7.6.0-7.6.99',
'typo3' => '>=8.7.0',
'cms' => '',
),
'conflicts' => array(),
......
......@@ -4,9 +4,9 @@ if (!defined('TYPO3_MODE')) {
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'SotaStudio.' . $_EXTKEY,
'SotaStudio.flexslider',
'Pi1',
array(
'FlexSlider' => 'list',
)
);
\ No newline at end of file
);
......@@ -2,61 +2,40 @@
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
// Build extension name vars - used for plugin registration, flexforms and similar
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_pi1';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'SotaStudio.' . $_EXTKEY,
'Pi1',
'FlexSlider'
);
// Clean up the Flexform fields in the backend a bit
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,splash_layout';
// Add own flexform stuff.
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
// Add custom Flexform fields
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform.xml');
// Add static TypoScript
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'FlexSlider');
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_flexslider_domain_model_flexslider', 'EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_csh_tx_flexslider_domain_model_flexslider.xml');
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_flexslider_domain_model_flexslider');
$TCA['tx_flexslider_domain_model_flexslider'] = array(
'ctrl' => array(
'title' => 'LLL:EXT:flexslider/Resources/Private/Language/locallang_db.xml:tx_flexslider_domain_model_flexslider',
'label' => 'name',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'origUid' => 't3_origuid',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'sortby' => 'sorting',
'delete' => 'deleted',
'enablecolumns' => array(
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
),
'dynamicConfigFile' => TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/FlexSlider.php',
'iconfile' => TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_flexslider_domain_model_flexslider.gif'
),
);
/**
* Add Plugin to New Content Element Wizard
*/
if (TYPO3_MODE === 'BE') {
// Add Plugin to CE Wizard
$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'][$pluginSignature . '_wizicon'] = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Resources/Private/Php/class.' . $_EXTKEY . '_wizicon.php';
}
\ No newline at end of file
call_user_func(
function()
{
$_EXTKEY='flexslider';
// Build extension name vars - used for plugin registration, flexforms and similar
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_pi1';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'SotaStudio.FlexSlider',
'Pi1',
'FlexSlider'
);
// Clean up the Flexform fields in the backend a bit
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,splash_layout';
// Add own flexform stuff.
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
// Add custom Flexform fields
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform.xml');
// Add static TypoScript
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'FlexSlider');
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_flexslider_domain_model_flexslider', 'EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_csh_tx_flexslider_domain_model_flexslider.xml');
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_flexslider_domain_model_flexslider');
/**
* Add Plugin to New Content Element Wizard
*/
if (TYPO3_MODE === 'BE') {
// Add Plugin to CE Wizard
$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'][$pluginSignature . '_wizicon'] = 'EXT: flexslider/Resources/Private/Php/class.flexslider_wizicon.php';
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment