Skip to content
Snippets Groups Projects
Commit dbe85573 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Fixing tremplates not found issue when having controller in backend folder

parent 64482660
No related branches found
No related tags found
1 merge request!2Feature be module
<?php
namespace SGalinski\SgNews\Controller\Backend;
namespace SGalinski\SgNews\Controller;
/***************************************************************
* Copyright notice
......@@ -36,7 +36,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
* News Controller
*/
class NewsController extends ActionController {
class BackendController extends ActionController {
/**
* DocHeaderComponent
......
<?php
namespace SGalinski\SgNews\ViewHelpers;
/***************************************************************
* 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\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
/**
* Abstract view helper
*/
class AbstractViewHelper extends AbstractBackendViewHelper {
/**
* Returns the base url of the site
*
* Note: Works only in frontend mode
*
* @return string
*/
public function getBaseUrl() {
if ($GLOBALS['TSFE']->absRefPrefix !== '') {
$baseUrl = $GLOBALS['TSFE']->absRefPrefix;
} else {
$baseUrl = $GLOBALS['TSFE']->baseUrl;
}
return $baseUrl;
}
}
<?php
namespace SGalinski\SgNews\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://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!
***************************************************************/
/**
* View helper to add custom javascript files
*
* Example:
* {namespace lfe=SGalinski\Lfeditor\ViewHelpers}
* <lfe:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Frontend.js')}" />
*/
class AddJavaScriptFileViewHelper extends AbstractViewHelper {
/**
* Adds a custom javascript file
*
* @param string $javaScriptFile
* @return void
*/
public function render($javaScriptFile) {
$javaScriptFile = (TYPO3_MODE === 'FE' ? $this->getBaseUrl() : '') . $javaScriptFile;
$this->getPageRenderer()->addJsFile($javaScriptFile);
}
}
?>
<?php
namespace SGalinski\SgNews\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the SG project. The SG 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;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
* View helper to render language labels to
* json array to be used in js applications.
*
* Renders to SG.lang.'extension name' object
*
* Example:
* {namespace rs=SGalinski\RsEvents\ViewHelpers}
* <rs:inlineLanguageLabels labels="label01,label02" />
*/
class InlineLanguageLabelsViewHelper extends AbstractViewHelper {
/**
* Renders the required javascript to make the language labels available
*
* @param string $labels Comma separated list of label keys to include
* @param boolean $htmlEscape
* @return string
*/
public function render($labels = '', $htmlEscape = FALSE) {
$extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
$labels = GeneralUtility::trimExplode(',', $labels, TRUE);
$languageArray = [];
foreach ($labels as $key) {
$value = LocalizationUtility::translate($key, $extensionName);
$languageArray[$key] = ($htmlEscape ? htmlentities($value) : $value);
}
return '
<script type="text/javascript">
var SG = SG || {};
SG.lang = SG.lang || {};
SG.lang.' . $extensionName . ' = SG.lang.' . $extensionName . ' || {};
var languageLabels = ' . json_encode($languageArray) . ';
for (label in languageLabels) {
SG.lang.' . $extensionName . '[label] = languageLabels[label];
}
</script>
';
}
}
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/
}
}
}
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}
}
}
}
{namespace sg=SGalinski\SgRoutes\ViewHelpers}
<f:layout name="Default" />
<f:layout name="Backend" />
<f:section name="iconButtons">
</f:section>
<f:section name="headline">
</f:section>
<f:section name="content">
<f:flashMessages />
<p>
......
......@@ -13,17 +13,6 @@ $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',
......
......@@ -35,7 +35,7 @@ if (TYPO3_MODE === 'BE') {
'News',
'',
[
'Backend\News' => 'index',
'Backend' => 'index',
],
[
'access' => 'user,group',
......
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