kaystrobach / TYPO3.dyncss

Dyncss base extension - Donate if you like it http://donate.kay-strobach.de/
http://forge.typo3.org/projects/extension-dyncss
GNU General Public License v2.0
9 stars 27 forks source link

Typo3 8.x #36

Closed sunixzs closed 7 years ago

sunixzs commented 7 years ago

Hi Kay,

very nice extension, thanks a lot. Will there be an adaption for Typo3 Version 8 in near future? Maybe there are only a few adjustments to do?

Nice greetings, Marcel

kaystrobach commented 7 years ago

Hey @sunixzs ,

thank you for your report.

Software needs testing. Open source in common lives from some kind of feedback.

Is there any known problem (except the warning in the extensionmanager) maybe, which causes a real problem for you? If not we may simply add the tests and are fine.

As the architecture and the code was clean AFAIK, there should not be a real problem. Please enrich your report with more information:

Thanks in advice Kay

sunixzs commented 7 years ago

Hi Kay,

ignoring the version warning while installing the first PHP error is: Class 'TYPO3\CMS\Backend\Sprite\SpriteManager' not found in file /ext_tables.php

I thought a missing icon is ok and removed the lines.

The next PHP error message is: #1228262000: KayStrobach\Dyncss\Hooks\Backend\Toolbar\ClearCacheActionsHook must implement interface TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface

I don't know how to implement a cache command in Typo3 8 :-( I commented out the two lines in ext_localconf.php and cleared the cache manually.

After starting the Back-end again the next message ist: 'No class named KayStrobach\Dyncss\Hooks\T3libPageRendererRenderPreProcessHook'

Then I changed line 34 in ext_localconf.php: #$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 'KayStrobach\Dyncss\Hooks\T3libPageRendererRenderPreProcessHook->execute';

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 'EXT:dyncss/Classes/Hooks/T3libPageRendererRenderPreProcessHook.php:&KayStrobach\\Dyncss\\Hooks\\T3libPageRendererRenderPreProcessHook->execute';

The next PHP error message after calling the Back-end is: Class 'KayStrobach\Dyncss\Service\DyncssService' not found

After removing the files in typo3conf/autoload/ the Back-end loads without errors.

The next thing is to install dyncss_scss or dyncss_less and set up some files and configuration. But this does not make sense when dyncss is not working correctly.

If you like I can give you Back-end access to a fresh Typo3 8.4.0 with only dyncss installed. Of course you'll get FTP access - maybe SSH is also possible.

Thank you for your efforts. Best wishes, Marcel

kaystrobach commented 7 years ago

Hello @sunixzs ok, thank you.

Sounds fixable

So I think i will start a new branch getting rid of some of the old APIs.

Maybe you can take a look into http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in and add the needed sections to ext_emconf.php ;) I would love to see a PR here.

sunixzs commented 7 years ago

Hi Kay,

i'm sorry. I'm not able to define class loading. But I thing this is not necessary.

I've made some following changes and it works for me. Maybe this is a start for dyncss in Typo3 8.x?

File ext_tables.php:

<?php

// \TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons(
// array(
// 'lightning-blue' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/lightning_blue.png',
// ),
// $_EXTKEY
// );
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance ( \TYPO3\CMS\Core\Imaging\IconRegistry::class );
$iconRegistry->registerIcon ( "lightning-blue", \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, [ 
        'source' => 'EXT:dyncss/Resources/Public/Icons/lightning_blue.png' 
] );

File ext_localconf.php:

if (!defined('TYPO3_MODE')) {
    die ('Access denied.');
}
#if(TYPO3_MODE === 'BE') {
    #$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 'KayStrobach\Dyncss\Hooks\T3libPageRendererRenderPreProcessHook->execute';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 'EXT:dyncss/Classes/Hooks/T3libPageRendererRenderPreProcessHook.php:&KayStrobach\\Dyncss\\Hooks\\T3libPageRendererRenderPreProcessHook->execute';
#} elseif(TYPO3_MODE === 'FE') {
#   $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][] = 'KayStrobach\Dyncss\Hooks\TslibFeContentPostProcAllHook->main';
#}

// clear cache item
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] = 'KayStrobach\Dyncss\Hooks\T3libTcemainHook->clearCachePostProc';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'][] = 'KayStrobach\Dyncss\Hooks\Backend\Toolbar\ClearCacheActionsHook';

    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'KayStrobach\Dyncss\Command\DyncssCommandController';

File Classes/Hooks/Backend/Toolbar/ClearCacheActionsHook.php:

<?php

/**
 * Created by PhpStorm.
 * User: kay
 * Date: 22.04.15
 * Time: 15:52
 */
namespace KayStrobach\Dyncss\Hooks\Backend\Toolbar;

use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
//use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class ClearCacheActionsHook implements ClearCacheActionsHookInterface {

    /**
     * Modifies CacheMenuItems array
     *
     * @param array $cacheActions Array of CacheMenuItems
     * @param array $optionValues Array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
     *
     * @return void
     */
    public function manipulateCacheActions(&$cacheActions, &$optionValues) {
        if ($this->getBackendUser ()->getTSConfigVal ( 'options.clearCache.system' ) || GeneralUtility::getApplicationContext ()->isDevelopment () || (( bool ) $GLOBALS[ 'TYPO3_CONF_VARS' ][ 'SYS' ][ 'clearCacheSystem' ] === TRUE && $this->getBackendUser ()->isAdmin ())) {

            $iconFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance ( \TYPO3\CMS\Core\Imaging\IconFactory::class );
            $icon = $iconFactory->getIcon ( 'lightning-blue', \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL );

            $cacheActions[] = array (
                    'id' => 'dyncss',
                    'title' => $this->getLanguageService ()->sL ( 'LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE ),
                    'description' => $this->getLanguageService ()->sL ( 'LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE ),
                    'href' => BackendUtility::getModuleUrl ( 'tce_db', [ 
                            'vC' => $this->getBackendUser ()->veriCode (),
                            'cacheCmd' => 'dyncss',
                            'ajaxCall' => 1 
                    ] ),
                    'icon' => $icon // IconUtility::getSpriteIcon ( 'extensions-dyncss-lightning-blue' )
            );
            $optionValues[] = 'dyncss';
        }
    }

After that the clearCache-Command is visible (with icon) and works.

The installation of dyncss_scss works fine when removing the typo3 version dependency in ext_tables.php. A scss-file will be included and parsed correctly:

page.includeCSS.testScss = fileadmin/test.scss

$color: red;
html {
    background-color: $color;
}

I hope with that above I can give you a little bit feedback.

Best regards, Marcel

anjeylink commented 7 years ago

Hi, i have created a pull request for typo3 8 compatibility. can you check it ? thank you https://github.com/kaystrobach/TYPO3.dyncss/pull/41