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

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

(cherry picked from commit 1b6450f0)
parent f0600927
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
namespace SGalinski\SgNews\Backend; namespace SGalinski\SgNews\Backend;
use SGalinski\SgNews\Domain\Model\Category; use SGalinski\SgNews\Domain\Model\Category;
use SGalinski\SgNews\Domain\Model\News;
use TYPO3\CMS\Backend\Controller\PageLayoutController; use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\ConnectionPool;
...@@ -36,17 +37,20 @@ use TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver; ...@@ -36,17 +37,20 @@ use TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver;
use TYPO3\CMS\Core\Utility\GeneralUtility; 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 { 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 array|NULL $params
* @param PageLayoutController|NULL $parentObj * @param PageLayoutController|NULL $parentObj
* @return string * @return string
* @throws \Doctrine\DBAL\Driver\Exception|\Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\Driver\Exception|\Doctrine\DBAL\DBALException
*/ */
public function render(array $params = NULL, PageLayoutController $parentObj = NULL): string { 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 ''; 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