Created
November 25, 2014 13:51
-
-
Save a-r-m-i-n/6d4085727a5d3416cf68 to your computer and use it in GitHub Desktop.
Approach to add my own overlay icons to pages in TYPO3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$boot = function($extensionKey) { | |
// Hook for additional overlay icon | |
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideIconOverlay'][] = | |
'EXT:' . $extensionKey . '/Classes/Hooks/OverrideIconOverlayHook.php:Sunzinet\SzPagesettings\Hooks\OverrideIconOverlayHook'; | |
}; | |
$boot($_EXTKEY); | |
unset($boot); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('TYPO3_MODE')) { | |
die('Access denied.'); | |
} | |
$boot = function($extensionKey) { | |
$GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayPriorities'][] = 'content_from_pid_isset'; | |
$GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames']['content_from_pid_isset'] = 'status-overlay-content-from-pid-isset'; | |
$GLOBALS['TBE_STYLES']['spriteIconApi']['coreSpriteImageNames'][] = 'status-overlay-content-from-pid-isset'; | |
$GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'][] = 'status-overlay-content-from-pid-isset'; | |
$GLOBALS['TBE_STYLES']['inDocStyles_TBEstyle'] .= " | |
.backgroundsize .t3-icon-overlay-content-from-pid-isset, .t3-icon-overlay-content-from-pid-isset { | |
background: url('/typo3conf/ext/sz_pagesettings/Resources/Public/Icons/content_from_pid_isset.png') no-repeat 1px 4px !important; | |
}"; | |
}; | |
$boot($_EXTKEY); | |
unset($boot); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Sunzinet\SzPagesettings\Hooks; | |
/** | |
* Class OverrideIconOverlay | |
* | |
* @package Sunzinet\SzFalExpiredate\Hooks | |
*/ | |
class OverrideIconOverlayHook { | |
/** | |
* Override icon overlay | |
* | |
* @param string $table | |
* @param array $row | |
* @param array $status | |
* @return void | |
*/ | |
public function overrideIconOverlay($table, $row, &$status) { | |
if ($table == 'pages' && !empty($row)) { | |
$this->overlayPages($row, $status); | |
} | |
} | |
/** | |
* Sets overlay icon for pages with content_from_pid set | |
* | |
* @param array $row | |
* @param array $status | |
* @return void | |
*/ | |
protected function overlayPages($row, &$status) { | |
if (isset($row['content_from_pid']) && intval($row['content_from_pid']) > 0) { | |
$status['content_from_pid_isset'] = TRUE; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment