-
-
Notifications
You must be signed in to change notification settings - Fork 4
#5: Include JS and CSS, display CE IDs in page and list module while … #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <?php | ||
|
|
||
| namespace GeorgRinger\BackendDebug\Utility; | ||
|
|
||
| /*************************************************************** | ||
| * Copyright notice | ||
| * | ||
| * (c) 2018 | ||
| * All rights reserved | ||
| * | ||
| * This script is part of the TYPO3 project. The TYPO3 | ||
| * project is | ||
| * free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as | ||
| * published by | ||
| * the Free Software Foundation; either version 3 of the | ||
| * License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * The GNU General Public License can be found at | ||
| * http://www.gnu.org/copyleft/gpl.html. | ||
| * | ||
| * This script is distributed in the hope that it will be | ||
| * useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied | ||
| * warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
| * the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * This copyright notice MUST APPEAR in all copies of the | ||
| * script! | ||
| ***************************************************************/ | ||
|
|
||
| use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
|
||
|
|
||
| class PageRenderer | ||
| { | ||
|
|
||
| /** | ||
| * Adds JavaCript and CSS to the Backend | ||
| * | ||
| * @param $params | ||
| * @param \TYPO3\CMS\Core\Page\PageRenderer $parent | ||
| */ | ||
| public function setup(&$params, \TYPO3\CMS\Core\Page\PageRenderer &$parent) | ||
| { | ||
|
|
||
| $params['jsInline']['BackendDebug'] = [ | ||
| 'code' => $this->getContextCode(), | ||
| 'section' => 1, | ||
| 'compress' => FALSE, | ||
| 'forceOnTop' => TRUE, | ||
| ]; | ||
|
|
||
| $parent->addCssInlineBlock('BackendDebug', $this->getCssCode()); | ||
| } | ||
|
|
||
| /** | ||
| * JavaScript Inline Code | ||
| * | ||
| * @return string | ||
| */ | ||
| protected function getContextCode() | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove, see below |
||
| { | ||
| $context = strtolower(GeneralUtility::getApplicationContext()); | ||
| $debug = $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] ? 'debug' : 'nodebug'; | ||
| $code = <<<EOT | ||
| var $ = TYPO3.jQuery; | ||
| $(document).ready(function(){ | ||
| $('body').addClass('$context').addClass('$debug'); | ||
| }); | ||
| EOT; | ||
|
|
||
| return $code; | ||
| } | ||
|
|
||
| /** | ||
| * CSS Inline Code | ||
| * | ||
| * @return string | ||
| */ | ||
| protected function getCssCode() | ||
| { | ||
| return <<<EOT | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just check the |
||
| body.debug .t3-page-ce-header-icons-left a:after, | ||
| body.debug .t3js-entity td.col-icon a.t3js-contextmenutrigger:after { | ||
| content: "[ID: " attr(data-uid) "]"; | ||
| padding-left: 5px; | ||
| } | ||
| EOT; | ||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,8 @@ | |
| $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\Form\Element\SelectSingleElement::class] = [ | ||
| 'className' => \GeorgRinger\BackendDebug\Xclass\SelectSingleElement::class, | ||
| ]; | ||
|
|
||
| $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 'GeorgRinger\BackendDebug\Utility\PageRenderer->setup'; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use ::class for the class and please don't call it PageRenderer but place it to BackendDebug\Hooks\PageRendererHook |
||
| }; | ||
|
|
||
| $boot(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong header, this is not part of the core