Skip to content
Snippets Groups Projects
Verified Commit 1b6450f0 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Add documentation and use DOK_TYPE_NEWS constant instead of number

parent d06f261f
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
namespace SGalinski\SgNews\Backend;
use SGalinski\SgNews\Domain\Model\Category;
use SGalinski\SgNews\Domain\Model\News;
use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
......@@ -36,17 +37,20 @@ use TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
*
* This class handles a warning message if the news is not located in a news category. It is implmeneted as a hook for
* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'] in ext_localconf.php
*/
class CategoryWarningDrawer {
/**
* Renders the error message, if the given $parentObj is a news page and has no category as parent page
*
* @param array|NULL $params
* @param PageLayoutController|NULL $parentObj
* @return string
* @throws \Doctrine\DBAL\Driver\Exception|\Doctrine\DBAL\DBALException
*/
public function render(array $params = NULL, PageLayoutController $parentObj = NULL): string {
if (!$parentObj || $parentObj->pageinfo['doktype'] !== 116) {
if (!$parentObj || $parentObj->pageinfo['doktype'] !== News::DOK_TYPE_NEWS) {
return '';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment