diff --git a/Classes/Controller/Backend/NewsController.php b/Classes/Controller/Backend/NewsController.php new file mode 100644 index 0000000000000000000000000000000000000000..8fc166f4bffad90ab6e81ae7934df4a672255ccc --- /dev/null +++ b/Classes/Controller/Backend/NewsController.php @@ -0,0 +1,80 @@ +<?php + +namespace SGalinski\SgNews\Controller\Backend; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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 SGalinski\SgNews\Service\Backend\Utility; +use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent; +use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; + +/** + * News Controller + */ +class NewsController extends ActionController { + + /** + * DocHeaderComponent + * + * @var DocHeaderComponent + */ + protected $docHeaderComponent; + + /** + * @var \SGalinski\SgNews\Domain\Repository\NewsRepository + * @inject + */ + private $newsRepository; + + /** + * @var \SGalinski\SgNews\Domain\Repository\CategoryRepository + * @inject + */ + private $categoryRepository; + + /** + * @var \SGalinski\SgNews\Domain\Repository\TagRepository + * @inject + */ + private $tagRepository; + + public function indexAction() { + // create doc header component + $pageUid = (int) GeneralUtility::_GP('id'); + /** @var BackendUserAuthentication $backendUser */ + $backendUser = $GLOBALS['BE_USER']; + $pageInfo = BackendUtility::readPageAccess($pageUid, $backendUser->getPagePermsClause(1)); + $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class); + + $this->docHeaderComponent->setMetaInformation($pageInfo); + Utility::makeButtons($this->docHeaderComponent, $this->request); + + $this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent()); + $this->view->assign('pageUid', $pageUid); + } +} diff --git a/Classes/Service/Backend/Utility.php b/Classes/Service/Backend/Utility.php new file mode 100644 index 0000000000000000000000000000000000000000..789d2408fe0086265c9932bd2bc85e15fa5d7fe2 --- /dev/null +++ b/Classes/Service/Backend/Utility.php @@ -0,0 +1,78 @@ +<?php + +namespace SGalinski\SgNews\Service\Backend; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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\Backend\Template\Components\ButtonBar; +use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent; +use TYPO3\CMS\Core\Imaging\Icon; +use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Mvc\Request; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + +/** + * Class Utility + */ +class Utility { + + /** + * create buttons for the backend module header + * + * @param $docHeaderComponent DocHeaderComponent + * @param $request Request + * @throws \InvalidArgumentException + * @throws \UnexpectedValueException + */ + public static function makeButtons(&$docHeaderComponent, &$request) { + /** @var ButtonBar $buttonBar */ + $buttonBar = $docHeaderComponent->getButtonBar(); + + /** @var IconFactory $iconFactory */ + $iconFactory = GeneralUtility::makeInstance(IconFactory::class); + + // Refresh + $refreshButton = $buttonBar->makeLinkButton() + ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) + ->setTitle(LocalizationUtility::translate('LLL:EXT:lang/locallang_core.xlf:labels.reload', '')) + ->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)); + $buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT); + + // shortcut button + $shortcutButton = $buttonBar->makeShortcutButton() + ->setModuleName($request->getPluginName()) + ->setGetVariables( + [ + 'id', + 'M' + ] + ) + ->setSetVariables([]); + + $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT); + $docHeaderComponent->getButtonBar(); + } +} diff --git a/Classes/ViewHelpers/Backend/ControlViewHelper.php b/Classes/ViewHelpers/Backend/ControlViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..060badb345c768672226fced8961afaa8819b603 --- /dev/null +++ b/Classes/ViewHelpers/Backend/ControlViewHelper.php @@ -0,0 +1,57 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers\Backend; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList; + +/** + * Class ControlViewHelper + **/ +class ControlViewHelper extends AbstractViewHelper { + /** + * Renders the control buttons for the specified record + * + * @param string $table + * @param mixed $row + * @return string + * @throws \InvalidArgumentException + * @throws \UnexpectedValueException + */ + public function render($table, $row) { + /** @var DatabaseRecordList $databaseRecordList */ + $databaseRecordList = GeneralUtility::makeInstance(DatabaseRecordList::class); + /** @var BackendUserAuthentication $backendUser */ + $backendUser = $GLOBALS['BE_USER']; + $pageInfo = BackendUtility::readPageAccess($row['pid'], $backendUser->getPagePermsClause(1)); + $databaseRecordList->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageInfo); + return $databaseRecordList->makeControl($table, $row); + } +} diff --git a/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php b/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..70d0fdd7e1ed35a5b1bd52b0642c2520027bd4f5 --- /dev/null +++ b/Classes/ViewHelpers/Backend/EditOnClickViewHelper.php @@ -0,0 +1,47 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers\Backend; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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\Backend\Utility\BackendUtility; +use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; + +/** + * Class EditOnClickViewHelper + **/ +class EditOnClickViewHelper extends AbstractViewHelper { + /** + * Renders the onclick script for editing a record + * + * @param string $table + * @param int $uid + * @param boolean $new + * @return string + */ + public function render($table, $uid, $new = FALSE) { + return BackendUtility::editOnClick('&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit'), '', -1); + } +} diff --git a/Classes/ViewHelpers/Backend/IconViewHelper.php b/Classes/ViewHelpers/Backend/IconViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..a27a54aa279fc7a8eaabeaa4570a1ea78ace1981 --- /dev/null +++ b/Classes/ViewHelpers/Backend/IconViewHelper.php @@ -0,0 +1,61 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers\Backend; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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\Backend\Utility\BackendUtility; +use TYPO3\CMS\Core\Imaging\Icon; +use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper; + +/** + * Class IconViewHelper + **/ +class IconViewHelper extends AbstractViewHelper { + /** + * Renders the icon for the specified record + * + * @param string $table + * @param mixed $row + * @param boolean $clickMenu + * @return string + * @throws \InvalidArgumentException + */ + public function render($table, $row, $clickMenu = TRUE) { + /** @var IconFactory $iconFactory */ + $iconFactory = GeneralUtility::makeInstance(IconFactory::class); + $toolTip = BackendUtility::getRecordToolTip($row, $table); + $iconImg = '<span ' . $toolTip . '>' + . $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() + . '</span>'; + if ($clickMenu) { + return BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']); + } else { + return $iconImg; + } + } +} diff --git a/Classes/ViewHelpers/Backend/Widget/Controller/PaginateController.php b/Classes/ViewHelpers/Backend/Widget/Controller/PaginateController.php new file mode 100644 index 0000000000000000000000000000000000000000..8d6f62b4f255fe993ed7ffa7c37842f13fe386e0 --- /dev/null +++ b/Classes/ViewHelpers/Backend/Widget/Controller/PaginateController.php @@ -0,0 +1,96 @@ +<?php + +namespace SGalinski\SgNews\ViewHelpers\Backend\Widget\Controller; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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! + ***************************************************************/ + +/** + * Class PaginateController + */ +class PaginateController extends \TYPO3\CMS\Fluid\ViewHelpers\Be\Widget\Controller\PaginateController { + + /** + * @var mixed + */ + protected $objects; + + /** + * Renders the paginator + * + * @param int $currentPage + * @return void + */ + public function indexAction($currentPage = 1) { + // set current page + $this->currentPage = (int) $currentPage; + if ($this->currentPage < 1) { + $this->currentPage = 1; + } + if ($this->currentPage > $this->numberOfPages) { + // set $modifiedObjects to NULL if the page does not exist + $modifiedObjects = NULL; + } else { + // modify query + $this->itemsPerPage = (int) $this->configuration['itemsPerPage']; + $this->offset = $this->itemsPerPage * ($this->currentPage - 1); + if (is_array($this->objects)) { + $modifiedObjects = []; + for ($index = $this->offset; $index < $this->offset + $this->itemsPerPage; $index++) { + if (isset($this->objects[$index])) { + $modifiedObjects[] = $this->objects[$index]; + } else { + break; + } + } + } else { + $query = $this->objects->getQuery(); + $query->setLimit($this->itemsPerPage); + if ($this->currentPage > 1) { + $query->setOffset($this->offset); + } + $modifiedObjects = $query->execute(); + } + } + $this->view->assign( + 'contentArguments', [ + $this->widgetConfiguration['as'] => $modifiedObjects + ] + ); + $this->view->assign('configuration', $this->configuration); + $this->view->assign('pagination', $this->buildPagination()); + } + + /** + * Returns an array with the keys "pages", "current", "numberOfPages", + * "nextPage" & "previousPage" + * + * @return array + */ + protected function buildPagination() { + $pagination = parent::buildPagination(); + $pagination['totalObjects'] = count($this->objects); + return $pagination; + } +} diff --git a/Classes/ViewHelpers/Backend/Widget/PaginateViewHelper.php b/Classes/ViewHelpers/Backend/Widget/PaginateViewHelper.php new file mode 100644 index 0000000000000000000000000000000000000000..c8bb2bdeb033e697f5510363d3dddf457cf3b5d7 --- /dev/null +++ b/Classes/ViewHelpers/Backend/Widget/PaginateViewHelper.php @@ -0,0 +1,64 @@ +<?php +namespace SGalinski\SgNews\ViewHelpers\Backend\Widget; + +/*************************************************************** + * Copyright notice + * + * (c) sgalinski Internet Services (https://www.sgalinski.de) + * + * 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 SGalinski\SgRoutes\ViewHelpers\Backend\Widget\Controller\PaginateController; +use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper; + +/** + * Class PaginateViewHelper + */ +class PaginateViewHelper extends AbstractWidgetViewHelper { + /** + * @var \SGalinski\SgRoutes\ViewHelpers\Backend\Widget\Controller\PaginateController + */ + protected $controller; + + /** + * Initializes the controller + * + * @param PaginateController $controller + */ + public function injectPaginateController( + PaginateController $controller + ) { + $this->controller = $controller; + } + + /** + * Renders the paginator + * + * @param mixed $objects + * @param string $as + * @param array $configuration + * @return string + */ + public function render( + $objects, $as, + array $configuration = ['itemsPerPage' => 10, 'insertAbove' => FALSE, 'insertBelow' => TRUE, 'recordsLabel' => ''] + ) { + return $this->initiateSubRequest(); + } +} diff --git a/Configuration/TypoScript/Backend/constants.txt b/Configuration/TypoScript/Backend/constants.txt new file mode 100644 index 0000000000000000000000000000000000000000..023c08a85a1548b52208396e33b3f5d800d81796 --- /dev/null +++ b/Configuration/TypoScript/Backend/constants.txt @@ -0,0 +1,22 @@ +module.tx_sgnews { + settings < plugin.tx_sgnews.settings + persistence < plugin.tx_sgnews.persistence + view < plugin.tx_sgnews.view + view { + # cat=plugin.tx_sgnews/file; type=string; label=Path to template root (FE) + templateRootPaths { + 10 = EXT:sg_news/Resources/Private/Backend/Templates/ + } + + # cat=plugin.tx_sgnews/file; type=string; label=Path to template partials (FE) + partialRootPaths { + 10 = EXT:sg_news/Resources/Private/Backend/Partials/ + } + + # cat=plugin.tx_sgnews/file; type=string; label=Path to template layouts (FE) + layoutRootPaths { + 10 = EXT:sg_news/Resources/Private/Backend/Layouts/ + } + } +} + diff --git a/Configuration/TypoScript/Backend/setup.txt b/Configuration/TypoScript/Backend/setup.txt new file mode 100644 index 0000000000000000000000000000000000000000..b23bfcbad31a8def92dc534df2b2f1e8c1d0ce12 --- /dev/null +++ b/Configuration/TypoScript/Backend/setup.txt @@ -0,0 +1,22 @@ +module.tx_sgnews { + settings < plugin.tx_sgnews.settings + persistence < plugin.tx_sgnews.persistence + view < plugin.tx_sgnews.view + view { + # cat=plugin.tx_sgnews/file; type=string; label=Path to template root (FE) + templateRootPaths { + 10 = {$module.tx_sgnews.view.templateRootPaths.10} + } + + # cat=plugin.tx_sgnews/file; type=string; label=Path to template partials (FE) + partialRootPaths { + 10 = {$module.tx_sgnews.view.partialRootPaths.10} + } + + # cat=plugin.tx_sgnews/file; type=string; label=Path to template layouts (FE) + layoutRootPaths { + 10 = {$module.tx_sgnews.view.layoutRootPaths.10} + } + } +} + diff --git a/Resources/Private/Backend/Layouts/Default.html b/Resources/Private/Backend/Layouts/Default.html new file mode 100644 index 0000000000000000000000000000000000000000..cea4b404f6a098af9c7b2317045d9ff5d1fb1760 --- /dev/null +++ b/Resources/Private/Backend/Layouts/Default.html @@ -0,0 +1,44 @@ +{namespace core = TYPO3\CMS\Core\ViewHelpers} +{namespace sg=SGalinski\SgNews\ViewHelpers} + +<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE" + includeRequireJsModules="{ + 0: 'TYPO3/CMS/Backend/AjaxDataHandler', + 1: '{f:if(condition: \'{typo3Version} < 8000000 \', then: \'TYPO3/CMS/Backend/ClickMenu\', else: \'TYPO3/CMS/Backend/ContextMenu\')}', + 2: 'TYPO3/CMS/Backend/Tooltip'}"> + + <sg:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Backend.js')}" /> + <f:format.raw> + <sg:inlineLanguageLabels labels="backend.delete_route, backend.delete_all, backend.htaccess" /> + </f:format.raw> + <div class="module" data-module-id="" data-module-name=""> + <div class="module-docheader t3js-module-docheader"> + <div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation"> + <div class="module-docheader-bar-column-left"> + </div> + <div class="module-docheader-bar-column-right"> + <span class="typo3-docheader-pagePath"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw></span> + <f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw> + </div> + </div> + <div class="module-docheader-bar module-docheader-bar-buttons t3js-module-docheader-bar t3js-module-docheader-bar-buttons"> + <div class="module-docheader-bar-column-left"> + <div class="btn-toolbar" role="toolbar" aria-label=""> + <f:render section="iconButtons" /> + </div> + </div> + <div class="module-docheader-bar-column-right"> + <f:render partial="ButtonBar" arguments="{buttons:docHeader.buttons.right}" /> + </div> + </div> + </div> + </div> + <div id="typo3-docbody"> + <div id="typo3-inner-docbody"> + <h1> + <f:render section="headline" /> + </h1> + <f:render section="content" /> + </div> + </div> +</f:be.container> diff --git a/Resources/Private/Backend/Partials/ButtonBar.html b/Resources/Private/Backend/Partials/ButtonBar.html new file mode 100644 index 0000000000000000000000000000000000000000..128d6a5cc0f5dc19186c25b6f694e97d09cd6ffd --- /dev/null +++ b/Resources/Private/Backend/Partials/ButtonBar.html @@ -0,0 +1,16 @@ +<div class="btn-toolbar" role="toolbar" aria-label=""> + <f:for each="{buttons}" as="buttonGroup"> + <f:if condition="{buttonGroup -> f:count()} > 1"> + <f:then> + <div class="btn-group" role="group" aria-label=""> + <f:for each="{buttonGroup}" as="button"> + {button -> f:format.raw()} + </f:for> + </div> + </f:then> + <f:else> + {buttonGroup.0 -> f:format.raw()} + </f:else> + </f:if> + </f:for> +</div> diff --git a/Resources/Private/Backend/Templates/News/Index.html b/Resources/Private/Backend/Templates/News/Index.html new file mode 100644 index 0000000000000000000000000000000000000000..651ad16f64a21284f31cb63454b6e343192d83ac --- /dev/null +++ b/Resources/Private/Backend/Templates/News/Index.html @@ -0,0 +1,14 @@ +{namespace sg=SGalinski\SgRoutes\ViewHelpers} + +<f:layout name="Default" /> + +<f:section name="iconButtons"> +</f:section> + +<f:section name="content"> + <f:flashMessages /> + <p> + <f:translate key="backend.message" /> + </p> + +</f:section> diff --git a/ext_localconf.php b/ext_localconf.php index 0ed3fdf6bb7dd568a9d2c74200079b2a557f1856..e0561cde56f7809200bcb0a2183c80dcb36af366 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -13,6 +13,17 @@ $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_news' $tsPath = $extPath . 'Configuration/TypoScript/Common/'; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(file_get_contents($tsPath . 'setup.txt')); +// backend typoscript configuration +if (TYPO3_MODE === 'BE') { + $tsPath = $extPath . 'Configuration/TypoScript/Backend/'; + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants( + file_get_contents($tsPath . 'constants.txt') + ); + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(file_get_contents($tsPath . 'setup.txt')); +} + // plugin configurations \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'SGalinski.sg_news', diff --git a/ext_tables.php b/ext_tables.php index 5c0fdb8d1c7438a21181b615e37c919823972a25..dcbe4274d7a44fad41dfd540d20e1291814e8950 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -28,6 +28,23 @@ TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'LLL:EXT:sg_news/Resources/Private/Language/locallang_backend.xlf:titleListByCategoryPlugin' ); +if (TYPO3_MODE === 'BE') { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + 'SGalinski.sg_news', + 'web', + 'News', + '', + [ + 'Backend\News' => 'index', + ], + [ + 'access' => 'user,group', + 'icon' => 'EXT:sg_news/Resources/Public/Images/News.png', + 'labels' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang.xlf', + ] + ); +} + // Removal of the unused plugin setting fields $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_overview'] = 'select_key,pages,recursive'; $TCA['tt_content']['types']['list']['subtypes_excludelist']['sgnews_listbycategory'] = 'select_key,pages,recursive';