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

Merge branch 'master' into feature_pluginPreview

parents 11e27034 d07f3aa8
No related branches found
No related tags found
1 merge request!24[FEATURE] Plugin Backend Previews
Showing
with 209 additions and 476 deletions
<?php
namespace SGalinski\SgNews\Utility;
/**
*
* 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\Core\Utility\VersionNumberUtility;
/**
* Class ExtensionUtility
*
* @package SGalinski\SgMail\Utility
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class ExtensionUtility {
/**
* Get the extension configuration
*
* @param string $extKey
* @return array
*/
public static function getExtensionConfiguration(string $extKey = 'sg_news'): array {
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$extConf = \unserialize(
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extKey], ['allowed_classes' => FALSE]
);
return is_array($extConf) ? $extConf : [];
}
return $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][$extKey] ?? [];
}
}
......@@ -34,7 +34,6 @@ use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
......@@ -77,12 +76,7 @@ class ControlViewHelper extends AbstractViewHelper {
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler');
$pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf');
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
} else {
$languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
}
$languageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
$languageService->includeLLFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf');
$databaseRecordList->currentTable = $sortingData;
......@@ -103,17 +97,6 @@ class ControlViewHelper extends AbstractViewHelper {
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$buttonLabel = LocalizationUtility::translate('backend.button.editPageContent', 'SgNews');
$path = '';
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$rootline = BackendUtility::BEgetRootLine($row['uid'], '', TRUE);
ksort($rootline);
$path = '/root';
foreach ($rootline as $page) {
$path .= '/p' . dechex($page['uid']);
}
$path = ', \'' . $path . '\'';
}
$onclick = 'return TYPO3.SgNewsModule.sgNewsGoToPageModule(' . $row['uid'] . $path . ');';
$icon = $iconFactory->getIcon('actions-document-open-white', Icon::SIZE_SMALL)->render();
$wrap = ' <div class="btn-group" role="group">%s</div>';
......
......@@ -28,7 +28,10 @@ namespace SGalinski\SgNews\ViewHelpers\Backend;
use SGalinski\SgNews\Utility\BackendNewsUtility;
use SGalinski\SgNews\ViewHelpers\AbstractViewHelper;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class EditOnClickViewHelper
......@@ -52,18 +55,36 @@ class EditOnClickViewHelper extends AbstractViewHelper {
* @return string
*/
public function render(): string {
$table = $this->arguments['table'];
$uid = $this->arguments['uid'];
$new = $this->arguments['new'];
$type = $this->arguments['type'];
$additionalParameters = '';
if ($new && $table === 'pages' && in_array($type, ['news', 'category'], TRUE)) {
$additionalParameters = '&overrideVals[pages][doktype]=' .
($type === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE);
$additionalParameters = [];
if ($this->arguments['new'] && $this->arguments['table'] === 'pages' && in_array($this->arguments['type'], ['news', 'category'], TRUE)) {
$additionalParameters = [
'overrideVals' =>
[
'pages' =>
[
'doktype' => $this->arguments['type'] === 'news' ? BackendNewsUtility::NEWS_DOKTYPE : BackendNewsUtility::CATEGORY_DOKTYPE
]
]
];
}
$parameters = [
'edit' => [
$this->arguments['table'] => [
$this->arguments['uid'] => [
$this->arguments['new'] ? 'new' : 'edit'
]
]
],
'returnUrl' => rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))
];
ArrayUtility::mergeRecursiveWithOverrule($parameters, $additionalParameters);
try {
return GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute(
'record_edit',
$parameters
);
} catch (RouteNotFoundException $exception) {
return '';
}
return BackendUtility::editOnClick(
'&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit') . $additionalParameters, '', -1
);
}
}
......@@ -35,7 +35,6 @@ use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Type\Icon\IconState;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
......@@ -94,13 +93,8 @@ class TranslationLinksViewHelper extends AbstractViewHelper {
$editLabel = LocalizationUtility::translate('backend.action.edit', 'SgNews');
$newLabel = LocalizationUtility::translate('backend.action.new', 'SgNews');
$translationParameters = '&cmd[' . $table . '][' . $row['uid'] . '][localize]=%s';
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$returnUrl = BackendUtility::getModuleUrl('web_SgNewsNews', ['id' => GeneralUtility::_GP('id')]);
} else {
$returnUrl = GeneralUtility::makeInstance(UriBuilder::class)
->buildUriFromRoute('web_SgNewsNews', ['id' => GeneralUtility::_GP('id')]);
}
$returnUrl = GeneralUtility::makeInstance(UriBuilder::class)
->buildUriFromRoute('web_SgNewsNews', ['id' => GeneralUtility::_GP('id')]);
foreach ($languages as $languageUid => $language) {
$translatedUid = 0;
if ((int) $languageUid <= 0) {
......@@ -115,26 +109,15 @@ class TranslationLinksViewHelper extends AbstractViewHelper {
}
if ($translatedUid) {
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$link = BackendUtility::getModuleUrl('record_edit', [
$link = GeneralUtility::makeInstance(UriBuilder::class)
->buildUriFromRoute('record_edit', [
'edit' => [
$translationTable => [
$translatedUid => 'edit'
]
],
'returnUrl' => $returnUrl
'returnUrl' => (string) $returnUrl
]);
} else {
$link = GeneralUtility::makeInstance(UriBuilder::class)
->buildUriFromRoute('record_edit', [
'edit' => [
$translationTable => [
$translatedUid => 'edit'
]
],
'returnUrl' => (string) $returnUrl
]);
}
$out .= ' <a href="' . $link . '" title="'. $language['title'] . ' [' . $editLabel . ']" >'
. $iconFactory->getIcon($language['flag'], Icon::SIZE_SMALL)->render()
......
<?php
return [
'sg_news:migrateNews' => [
'class' => \SGalinski\SgNews\Command\MigrateNewsCommandController::class
]
];
<?php
declare(strict_types=1);
// if you need to change this, keep in mind the changes need to be done in
// Configuration/TypoScript/Common/setup.typoscript for TYPO3 9, too
return [
\SGalinski\SgNews\Domain\Model\News::class => [
'tableName' => 'pages',
'recordType' => \SGalinski\SgNews\Domain\Model\News::DOK_TYPE_NEWS,
'properties' => [
'highlighted' => [
'fieldName' => 'tx_sgnews_highlighted'
],
'neverHighlighted' => [
'fieldName' => 'tx_sgnews_never_highlighted'
],
'relatedNews' => [
'fieldName' => 'tx_sgnews_related_news'
],
'newsAuthor' => [
'fieldName' => 'tx_sgnews_news_author'
],
'lastUpdated' => [
'fieldName' => 'lastUpdated'
],
'creationDate' => [
'fieldName' => 'crdate'
],
'teaser1Image' => [
'fieldName' => 'tx_sgnews_teaser1_image'
],
'teaser2Image' => [
'fieldName' => 'tx_sgnews_teaser2_image'
],
'tags' => [
'fieldName' => 'tx_sgnews_tags'
],
'likes' => [
'fieldName' => 'tx_sgnews_likes'
],
'contentFromAnotherPage' => [
'fieldName' => 'tx_sgnews_content_from_another_page'
],
'location' => [
'fieldName' => 'tx_sgnews_location'
],
'dateEnd' => [
'fieldName' => 'tx_sgnews_date_end'
]
]
],
\SGalinski\SgNews\Domain\Model\Category::class => [
'tableName' => 'pages',
'recordType' => \SGalinski\SgNews\Domain\Model\Category::DOK_TYPE_CATEGORY,
'properties' => [
'teaser1Image' => [
'fieldName' => 'tx_sgnews_teaser1_image'
],
'teaser2Image' => [
'fieldName' => 'tx_sgnews_teaser2_image'
]
]
],
\SGalinski\SgNews\Domain\Model\Tag::class => [
'tableName' => 'sys_category'
],
\SGalinski\SgNews\Domain\Model\FileReference::class => [
'tableName' => 'sys_file_reference'
]
];
......@@ -225,11 +225,6 @@ call_user_func(
'items' => [
['', ''],
],
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
'fieldControl' => [
'addRecord' => [
'disabled' => FALSE,
......@@ -250,12 +245,7 @@ call_user_func(
'maxitems' => 1,
'items' => [
['', ''],
],
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
]
],
],
'tx_sgnews_related_news' => [
......@@ -268,12 +258,7 @@ call_user_func(
'allowed' => $table,
'size' => 5,
'minitems' => 0,
'maxitems' => 99,
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
'maxitems' => 99
],
],
'tx_sgnews_highlighted' => [
......@@ -398,60 +383,45 @@ call_user_func(
'canNotCollapse' => 1,
];
// Removal of the realurl fields, if the extension isn't installed.
if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
$GLOBALS['TCA'][$table]['palettes']['titleDescriptionAndHighlightFlag'] = str_replace(
'--linebreak--, tx_realurl_pathsegment, tx_realurl_exclude,', '',
$GLOBALS['TCA'][$table]['palettes']['titleDescriptionAndHighlightFlag']
);
$GLOBALS['TCA'][$table]['types'][117] = str_replace(
'tx_realurl_pathsegment, tx_realurl_exclude,', '',
$GLOBALS['TCA'][$table]['types'][117]
);
}
if (\version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '>')) {
// if TYPO3 9.5, exclude a lot of fields from the news doktype in localizations
foreach (
$GLOBALS['TCA'][$table]['columns'] as $languageExcludeField => $_
foreach (
$GLOBALS['TCA'][$table]['columns'] as $languageExcludeField => $_
) {
if (
!\in_array(
$languageExcludeField, [
'doktype',
'title',
'subtitle',
'description',
'slug',
'tx_projectbase_path_segment',
'tx_projectbase_excludefromsluggeneration',
'tx_sgnews_location',
'tx_sgnews_teaser1_image',
'tx_sgnews_teaser2_image',
'tx_sgnews_tags',
'abstract',
'tx_projectbase_seo_titletag',
'tx_projectbase_seo_canonicaltag',
'hidden',
'sys_language_uid',
'tx_languagevisibility_visibility',
'lastUpdated',
'tx_sgnews_date_end',
'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted',
]
)
) {
if (
!\in_array(
$languageExcludeField, [
'doktype',
'title',
'subtitle',
'description',
'slug',
'tx_projectbase_path_segment',
'tx_projectbase_excludefromsluggeneration',
'tx_sgnews_location',
'tx_sgnews_teaser1_image',
'tx_sgnews_teaser2_image',
'tx_sgnews_tags',
'abstract',
'tx_projectbase_seo_titletag',
'tx_projectbase_seo_canonicaltag',
'hidden',
'sys_language_uid',
'tx_languagevisibility_visibility',
'lastUpdated',
'tx_sgnews_date_end',
'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted',
]
)
) {
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides'][$languageExcludeField]['l10n_mode'] = 'exclude';
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides'][$languageExcludeField]['l10n_mode'] = 'exclude';
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['title']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.title';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['subtitle']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.subtitle';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['slug']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.slug';
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['title']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.title';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['subtitle']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.subtitle';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['slug']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.slug';
}, 'sg_news', 'pages'
);
<?php
/**
*
* 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!
*/
if (\version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
call_user_func(
function ($extKey, $table) {
$pagesTable = 'pages';
$localLangDbPath = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:';
$localLangBackendPath = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_backend.xlf:';
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] .= ',tx_sgnews_teaser1_image,tx_sgnews_teaser2_image';
foreach (
[
\SGalinski\SgNews\Utility\BackendNewsUtility::CATEGORY_DOKTYPE => [
'icon' => 'EXT:sg_news/Resources/Public/Images/Category.png',
'locallangIndex' => 'pageType.category'
],
\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE => [
'icon' => 'EXT:sg_news/Resources/Public/Images/News.png',
'locallangIndex' => 'pageType.news'
]
] as $doktype => $configuration) {
// also add the new doktype to the page language overlays type selector (so that translations can inherit the same type)
$GLOBALS['TCA'][$table]['columns']['doktype']['config']['items'][] = [
$localLangBackendPath . $configuration['locallangIndex'],
$doktype,
$configuration['icon']
];
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE] = [
'showitem' => '--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.standard;standard,
subtitle;' . $localLangDbPath . $pagesTable . '.subtitle.inPalette,
description, tx_realurl_pathsegment, author, tx_sgnews_location,
--div--;' . $localLangDbPath . $pagesTable . '.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $pagesTable . '.tabs.metadata,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $pagesTable . '.palettes.abstract;abstract,
tx_projectbase_seo_titletag,tx_projectbase_seo_canonicaltag,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
sys_language_uid,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.visibility;hiddenonly,
--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.access;access'
];
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::CATEGORY_DOKTYPE] = [
'showitem' => '--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.standard;standard,
title, tx_realurl_pathsegment,
--div--;' . $localLangDbPath . $table . '.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $pagesTable . '.tabs.metadata,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $pagesTable . '.palettes.abstract;abstract,
tx_projectbase_seo_titletag,tx_projectbase_seo_canonicaltag, description,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
sys_language_uid,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.visibility;hiddenonly,
--palette--;LLL:EXT:cms/locallang_tca.xlf:' . $pagesTable . '.palettes.access;access'
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
$table, [
'tx_sgnews_teaser1_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $pagesTable . '.tx_sgnews_teaser1_image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser1_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showRemovedLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'tx_sgnews_teaser2_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $pagesTable . '.tx_sgnews_teaser2_image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser2_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showRemovedLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'tx_sgnews_location' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $pagesTable . '.tx_sgnews_location',
'config' => [
'type' => 'input',
'size' => 20,
'eval' => 'trim'
]
]
]
);
}, 'sg_news', 'pages_language_overlay'
);
}
......@@ -45,10 +45,7 @@ $configuration = [
'transOrigDiffSourceField' => 'l10n_diffsource',
'iconfile' => 'EXT:sg_news/Resources/Public/Icons/module-sgnews.svg'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, crdate, name, email,
description, website, image, path_segment',
],
'interface' => [],
'types' => [
'1' => [
'showitem' => 'hidden;;1, --palette--;;authorInfos, path_segment, description'
......@@ -73,7 +70,7 @@ $configuration = [
'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:tx_sgnews_domain_model_author.crdate',
'config' => [
'type' => 'input',
'max' => '20',
'max' => 20,
'eval' => 'datetime',
'default' => $GLOBALS['EXEC_TIME'],
]
......@@ -105,7 +102,6 @@ $configuration = [
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => TRUE,
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
......@@ -197,12 +193,8 @@ $configuration = [
],
]
];
// The slug field isn't available for TYPO3 8 and below.
if (TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 9000000) {
unset($configuration['columns']['path_segment']);
$configuration['types'] = str_replace('path_segment', '', $configuration['types']);
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '10.3.0', '<')) {
$configuration['interface']['showRecordFieldList'] = 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, crdate, name, email, description, website, image, path_segment';
}
return $configuration;
config.tx_extbase {
persistence {
classes {
# @deprecated This configuration does not work in TYPO3 10 at all, you need to also change
# Configuration/Extbase/Persistence/Classes.php
SGalinski\SgNews\Domain\Model\News {
mapping {
tableName = pages
......
......@@ -8,7 +8,7 @@ Repository: https://gitlab.sgalinski.de/typo3/sg_news
Please report bugs here: https://gitlab.sgalinski.de/typo3/sg_news
TYPO3 version: >=7.6
TYPO3 version: >=9.5
**Note**: sg_news can be used for free or by buying a licence key from our <a href="https://shop.sgalinski.de/products/" target="_blank">online shop</a>. You can enter the licence key in the extension manager configuration of sg_news.
......@@ -27,15 +27,11 @@ additional meta information.
This extensions adds the behaviour, that the images of the localization of a news or categories could be differ
to the image in the default language. So the images can be translated now.
NOTE: This extension is just working, if the patch "pages_language_overlay_fix.diff" is active. The pull request for
this patch could be found here: [pull request](https://github.com/froemken/repair_translation/pull/1)
## Integration
Before using sg_news you need to supply your frontend some information on how the extension needs to be integrated into your template.
Before using sg_news you need to supply your frontend some information on how the extension needs to be integrated into your template.
As the extension itself provides two new [doktypes](https://docs.typo3.org/typo3cms/CoreApiReference/PageTypes/Index.html), you can simply add a switch case to your Fluid template to provide different rendering paths.
As the extension itself provides two new [doktypes](https://docs.typo3.org/typo3cms/CoreApiReference/PageTypes/Index.html), you can simply add a switch case to your Fluid template to provide different rendering paths.
### Example
......@@ -87,14 +83,14 @@ lib.pageTemplate.default {
}
```
In this example we will load the first column for the intro section by default
and the second column in the backend for the content below that.
In this example we will load the first column for the intro section by default
and the second column in the backend for the content below that.
The news category (doktype 117) will render by default not the content on the page alone, but also the default category listing.
The news category (doktype 117) will render by default not the content on the page alone, but also the default category listing.
With our example we don't want the intro section (116) and the default content to be rendered, because the extension handles those parts.
The single news plugin also needs some additional information so it can get the base content.
The single news plugin also needs some additional information so it can get the base content.
By default it will resolve to the following code if not provided by you:
```
......@@ -102,8 +98,8 @@ lib.mainContent < styles.content.col1
```
### Example integration into your page template
Finally you need to output the **INTRO** and **CONTENT** variable in your page template:
Finally you need to output the **INTRO** and **CONTENT** variable in your page template:
<main>
<!--TYPO3SEARCH_begin-->
<f:if condition="{INTRO}">
......@@ -112,7 +108,7 @@ Finally you need to output the **INTRO** and **CONTENT** variable in your page t
{BREADCRUMB_MENU -> f:format.raw()}
</div>
</f:if>
<div class="main-content">
{CONTENT -> f:format.raw()}
</div>
......@@ -144,7 +140,7 @@ routeEnhancers:
In addition to categories, multiple tags can be created and specified for each news page.
Tags can be created by adding sys_category records to the root page of the news block (blog).
In order to differentiate each block's tags from the others,
In order to differentiate each block's tags from the others,
the PageTS value of **TCEFORM.pages.tx_sgnews_tags.PAGE_TSCONFIG_ID**
can be set for each of the blocks containing the pid value for the selectable tags.
......@@ -157,31 +153,31 @@ Add the plugin **News Overview** and optionally the plugin **Latest News** to a
After that you must create sites of type **Category** sites below the blog page level and name them accordingly.
On the next lower page level of each **Category** you can create pages of type **News**.
On these pages you can use all your usual content elements to visualize your news entries belonging to the specific category.
On the next lower page level of each **Category** you can create pages of type **News**.
On these pages you can use all your usual content elements to visualize your news entries belonging to the specific category.
### Plugins
General settings for the plugins can be found in the **Frontend/setup.txt** and **Frontend/constants.txt** TypoScript file:
*setup.txt*
settings {
# Name of your site - required for the news.xml
siteName =
# Your rootpage id - required for the news.xml to retrieve the base path
rootpageId = 1
# News limit (can be usually set also inside the flexforms)
newsLimitPerPage = {$plugin.tx_sgnews.settings.newsLimitPerPage}
# Uid of the page containing sys_category records used as tags
tagPid = {$plugin.tx_sgnews.settings.tagPid}
# How to sort the news in general (date, positionInTree)
sortBy = date
}
*constants.txt*
settings {
......@@ -225,7 +221,7 @@ Provides a RSS Feed **news.xml** as a typenum. The typenum is defined in the **F
newsFeed = PAGE
newsFeed {
typeNum = 78906523
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
......@@ -243,7 +239,7 @@ Provides a RSS Feed **news.xml** as a typenum. The typenum is defined in the **F
showCategories =
}
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/xml
......@@ -253,19 +249,19 @@ Provides a RSS Feed **news.xml** as a typenum. The typenum is defined in the **F
}
---
###### PageBrowser
Automatically adds a pagination to the **News Overview** and **List News** plugins.
Automatically adds a pagination to the **News Overview** and **List News** plugins.
You find the settings in the **Fontend/constants.txt** configuration file:
pagebrowser.settings {
# Number of page links to show before the current page
pagesBefore = 1
# Number of page links to show before the current page
pagesAfter = 1
# Enables section for "more" pages. This section is shown after links to next pages, normally like three dots (1 2 3 ...). Notice that you can also hide it by emptying corresponding template section.
enableMorePages = 1
# Enables section for "less" pages. This section is shown after links to next pages, normally like three dots (... 1 2 3) Notice that you can also hide it by emptying corresponding template section.
enableLessPages = 1
}
......@@ -278,7 +274,7 @@ If it should be like this, then make sure to remove this button from the sg_news
## The Backend Module
After a successful Installation, you have a new module in the "WEB" section of your TYPO3 Backend.
After a successful Installation, you have a new module in the "WEB" section of your TYPO3 Backend.
Clicking on it loads the administration panel. Using the drop-down above you can switch between the different languages set up in your TYPO3 installation.
Once you have selected a language, the module will display the news records and tag filter corresponding to that language.
......@@ -294,7 +290,7 @@ You can also use the '<img height="20px" width="20px" src="https://camo.githubus
### Options for your news list items
For each news item in the paginated result list you have multiple editing/administration options, depending on the logged-in user's permissions.
For each news item in the paginated result list you have multiple editing/administration options, depending on the logged-in user's permissions.
You can click a list item's title to edit it (language sensitive) or use the menu buttons:
......@@ -312,7 +308,7 @@ You can click a list item's title to edit it (language sensitive) or use the men
<br>
<img height="20px" width="20px" src="https://camo.githubusercontent.com/b4980d61f65fdfca4853fbd240f88de2b6fcb893/68747470733a2f2f7261776769742e636f6d2f5459504f332f5459504f332e49636f6e732f6d61737465722f646973742f616374696f6e732f616374696f6e732d706167652d6d6f76652e737667"> Change the page's position in the page-tree
<br>
<img height="20px" width="20px" src="https://camo.githubusercontent.com/91c383d7beded93dbe6a62e2a1ae94bf82d1d783/68747470733a2f2f7261776769742e636f6d2f5459504f332f5459504f332e49636f6e732f6d61737465722f646973742f616374696f6e732f616374696f6e732d646f63756d656e742d686973746f72792d6f70656e2e737667"> Show history
<img height="20px" width="20px" src="https://camo.githubusercontent.com/91c383d7beded93dbe6a62e2a1ae94bf82d1d783/68747470733a2f2f7261776769742e636f6d2f5459504f332f5459504f332e49636f6e732f6d61737465722f646973742f616374696f6e732f616374696f6e732d646f63756d656e742d686973746f72792d6f70656e2e737667"> Show history
<br>
<img height="20px" width="20px" src="https://camo.githubusercontent.com/78584763b0c5d3c1908183719f3b37508bd54620/68747470733a2f2f7261776769742e636f6d2f5459504f332f5459504f332e49636f6e732f6d61737465722f646973742f616374696f6e732f616374696f6e732d6c6f636b2e737667"> Change permissions
<br>
......@@ -351,4 +347,3 @@ This extension comes with the command controller task **** to migirate tx_news e
To use your old file references, you need to import your sys_file and sys_file_reference_table as sys_file_news_migration and sys_file_reference
into your database. The Filepaths must not change!
......@@ -58,7 +58,7 @@
<f:alias map="{newsItemTags: '{sg:backend.newsItemTags(uid: singleNews.uid, languageUid: language)}'}">
<f:if condition="{singleNews.translation_uid}">
<f:then>
<a href="#" onclick="{sg:backend.editOnClick(table: 'pages_language_overlay', uid: singleNews.translation_uid)}">
<a href="#" onclick="{sg:backend.editOnClick(table: 'pages', uid: singleNews.translation_uid)}">
<span>
<f:if condition="{singleNews.translation_title}">
<f:then>
......
......@@ -54,3 +54,7 @@ In order for your module bundler to find the ```sgnews``` package, you need to a
}
}
```
## Version 9 Breaking Changes
- Dropped TYPO3 8 support
......@@ -6,7 +6,7 @@
"license": [
"GPL-2.0-or-later"
],
"version": "8.4.2",
"version": "9.0.0-dev",
"support": {
},
"repositories": [
......@@ -24,7 +24,7 @@
}
],
"require": {
"typo3/cms-core": "^8.7.0 || ^9.5.1"
"typo3/cms-core": "^9.5.0 || ^10.4.0"
},
"require-dev": {
"roave/security-advisories": "dev-master"
......
<?php
$EM_CONF[$_EXTKEY] = [
$EM_CONF['sg_news'] = [
'title' => 'News System',
'description' => 'News System',
'category' => 'plugin',
......@@ -19,17 +19,17 @@ $EM_CONF[$_EXTKEY] = [
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '8.4.2',
'version' => '9.0.0-dev',
'constraints' => [
'depends' => [
'typo3' => '8.7.0-9.5.99',
'php' => '7.0.0-7.3.99',
'typo3' => '9.5.0-10.4.99',
'php' => '7.3.0-7.4.99',
],
'conflicts' => [],
'suggests' => [
'sg_comments' => '3.0.0',
'sg_ajax' => '2.0.0',
'languagevisibility' => '2.0.0',
'sg_comments' => '5.0.0',
'sg_ajax' => '3.0.0',
'languagevisibility' => '3.0.0',
],
],
'suggests' => [],
......
......@@ -28,7 +28,7 @@ call_user_func(
function ($extKey) {
// common typoscript configuration
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . '/Configuration/TypoScript/Common/setup.typoscript">'
'@import "EXT:' . $extKey . '/Configuration/TypoScript/Common/setup.typoscript"'
);
// plugin configurations
......@@ -106,12 +106,6 @@ call_user_func(
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Core\Page\PageRenderer'] =
['className' => 'SGalinski\SgNews\Xclass\PageRenderer'];
// add realurl configuration
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration']['sgnews'] =
\SGalinski\SgNews\Hooks\RealUrlAutoConfiguration::class . '->addNewsConfig';
}
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class
......@@ -130,10 +124,6 @@ call_user_func(
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'][] =
\SGalinski\SgNews\Hooks\PageLayoutController::class . '->addNewsModuleLink';
// register command controllers
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] =
'SGalinski\SgNews\Command\MigrateNewsCommandController';
// add the new doktype to the list of types available from the new page menu at the top of the page tree
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
'options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . \SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE . ')' . PHP_EOL
......@@ -143,11 +133,13 @@ call_user_func(
\SGalinski\SgNews\Utility\BackendNewsUtility::registerIcons();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . '/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig">'
'@import "EXT:' . $extKey . '/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"'
);
// Add upgrade wizards
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['tx_sgnews_update_authors'] =
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgNews\Updates\UpdateAuthors::IDENTIFIER] =
\SGalinski\SgNews\Updates\UpdateAuthors::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\SGalinski\SgNews\Updates\MigrateSchedulerTasks::IDENTIFIER] =
\SGalinski\SgNews\Updates\MigrateSchedulerTasks::class;
}, 'sg_news'
);
......@@ -32,10 +32,6 @@ call_user_func(
if (TYPO3_MODE === 'BE') {
$navigationComponentId = 'TYPO3/CMS/Backend/PageTree/PageTreeElement';
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '<')) {
$navigationComponentId = 'typo3-pagetree';
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'SGalinski.' . $extKey,
'web',
......
......@@ -10,40 +10,14 @@ CREATE TABLE pages (
tx_sgnews_location mediumtext,
tx_sgnews_date_end int(10) unsigned DEFAULT '0' NOT NULL,
tx_sgnews_content_from_another_page int(11) unsigned DEFAULT '0' NOT NULL,
KEY news_author (tx_sgnews_news_author)
);
CREATE TABLE pages_language_overlay (
tx_sgnews_teaser1_image int(11) unsigned DEFAULT '0' NOT NULL,
tx_sgnews_teaser2_image int(11) unsigned DEFAULT '0' NOT NULL,
tx_sgnews_location mediumtext
);
CREATE TABLE tx_sgnews_domain_model_author (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
-- Custom fields
name varchar(255) DEFAULT '' NOT NULL,
email varchar(255) DEFAULT '' NOT NULL,
description text,
website text,
path_segment text,
image int(11) unsigned DEFAULT '0',
-- TYPO3 fields
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY language (l10n_parent,sys_language_uid)
image int(11) unsigned DEFAULT '0'
);
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