Я написал небольшое расширение, которое добавляет некоторые поля в таблицу sys_category.Все отлично работает в FE, если я вошел в BE.Но если я очищу (красные) кэши и выйду из BE, категории в FE не найдены.После входа в BE и повторной очистки кешей, FE работает так, как ожидалось, и отображаются категории.
Кто-нибудь знает, в чем моя ошибка?
ОБНОВЛЕНИЕ
У меня в TCA моей модели для категорий полей реализован код от Георга Рингера EXT: новости и все работает.Я могу очистить кеши, выйти из BE и категории доступны в FE.
'categories' => [
'exclude' => true,
'label' => $ll . 'tx_news_domain_model_news.categories',
'config' => [
'type' => 'select',
'renderType' => 'selectTree',
'treeConfig' => [
'dataProvider' => \GeorgRinger\News\TreeProvider\DatabaseTreeDataProvider::class,
'parentField' => 'parent',
'appearance' => [
'showHeader' => true,
'expandAll' => true,
'maxLevels' => 99,
],
],
'MM' => 'sys_category_record_mm',
'MM_match_fields' => [
'fieldname' => 'categories',
'tablenames' => 'tx_geevents_domain_model_event',
],
'MM_opposite_field' => 'items',
'foreign_table' => 'sys_category',
'foreign_table_where' => ' AND (sys_category.sys_language_uid = 0 OR sys_category.l10n_parent = 0) ORDER BY sys_category.sorting',
'size' => 10,
'minitems' => 0,
'maxitems' => 99,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
]
],
Моя модель:
/**
* categories
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\GE\GeEvents\Domain\Model\Category>
* @lazy
*/
protected $categories;
/**
* Get categories
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\GE\GeEvents\Domain\Model\Category>
*/
public function getCategories()
{
return $this->categories;
}
/**
* Set categories
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories
* @return void
*/
public function setCategories($categories)
{
$this->categories = $categories;
}
Моя модель категории:
/**
* txGeeventsIcon
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @cascade remove
*/
protected $txGeeventsIcon = null;
/**
* txGeeventsPidList
*
* @var integer
*/
protected $txGeeventsPidList = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
protected function initStorageObjects()
{
$this->txGeeventsIcon = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getTxGeeventsIcon()
{
return $this->txGeeventsIcon;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $txGeeventsIcon
*/
public function setTxGeeventsIcon($txGeeventsIcon)
{
$this->txGeeventsIcon = $txGeeventsIcon;
}
/**
* @return int
*/
public function getTxGeeventsPidList()
{
return $this->txGeeventsPidList;
}
/**
* @param int $txGeeventsPidList
*/
public function setTxGeeventsPidList($txGeeventsPidList)
{
$this->txGeeventsPidList = $txGeeventsPidList;
}
Мои sys_category.php Переопределяет TCA:
$fields = [
'tx_geevents_pid_list' => [
'label' => 'List Page',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => '1',
'maxitems' => '200',
'minitems' => '0',
'show_thumbs' => '1',
'maxitems' => 1,
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
],
],
'tx_geevents_icon' => [
'exclude' => true,
'label' => 'Icon',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'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'
]
],
'maxitems' => 1
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
];
// Add new fields to pages:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_category', $fields);
// Make fields visible in the TCEforms:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'sys_category', // Table name
'--div--;Göpel Events;tx_geevents', // Field list to add
'1', // List of specific types to add the field list to. (If empty, all type entries are affected)
'' // Insert fields before (default) or after one, or replace a field
);
// Add the new palette:
$GLOBALS['TCA']['sys_category']['palettes']['tx_geevents'] = array(
'showitem' => 'tx_geevents_pid_list, tx_geevents_icon'
);