Skip to content

Instantly share code, notes, and snippets.

@kaystrobach
Last active August 29, 2015 14:06
Show Gist options
  • Save kaystrobach/deec41d7da688c8758ba to your computer and use it in GitHub Desktop.
Save kaystrobach/deec41d7da688c8758ba to your computer and use it in GitHub Desktop.
iconOverlay
/**
* register hook for icon overlay
*/
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideIconOverlay'][]
= 'KayStrobach\\Themes\\Hook\\IconUtilityHook';
/**
* add themes overlay
*/
array_push($GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayPriorities'], 'themefound');
$GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames']['themefound'] = 'extensions-themes-overlay-theme';
/**
* add sprites
*/
\TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons(
array(
'switch-off' => ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/power_orange.png',
'switch-disable' => ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/power_grey.png',
'switch-on' => ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/power_green.png',
'overlay-theme' => ExtensionManagementUtility::extRelPath($_EXTKEY) . 'Resources/Public/Icons/overlay_theme.png',
),
$_EXTKEY
);
<?php
namespace KayStrobach\Themes\Hook;
use KayStrobach\Themes\Utilities\CheckPageUtility;
/**
* Class PageNotFoundHandlingHook
*
* @package KayStrobach\Themes\Hook
*/
class IconUtilityHook {
/**
* adds the overlay icon to a page with a theme set
*
* @param $table
* @param $row
* @param $status
* @return void
*/
public function overrideIconOverlay($table, &$row, &$status) {
if ($table === 'pages') {
if (CheckPageUtility::hasTheme($row['uid']) > 0) {
$status['themefound'] = TRUE;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment