所以我创建了一个自己的内容元素(“ Foundation”按钮),并且我已经注册了它自己的图标,并且应该在后端显示什么。现在我仍然缺少的是每种内容的样式和模板。我在网上找到了一个示例,我想知道它是如何完成的。我找不到有关如何实现它的在线指南。
这是我的内容元素
这就是我希望它在后端显示的方式
由于我不知道该如何实现,因此我不确定应该在此处发布什么代码,但是我可以发布ButtonPreviewRendereder.php
<?php
namespace Vendor\BwSeitenameBase\Hooks\PageLayoutView;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface;
use \TYPO3\CMS\Backend\View\PageLayoutView;
/**
* Contains a preview rendering for the page module of CType="yourextensionkey_newcontentelement"
*/
class ButtonPreviewRenderer implements PageLayoutViewDrawItemHookInterface
{
/**
* Preprocesses the preview rendering of a content element of type "My new content element"
*
* @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object
* @param bool $drawItem Whether to draw the item using the default functionality
* @param string $headerContent Header content
* @param string $itemContent Item content
* @param array $row Record row of tt_content
*
* @return void
*/
public function preProcess(
PageLayoutView &$parentObject,
&$drawItem,
&$headerContent,
&$itemContent,
array &$row
)
{
if ($row['CType'] === 'foundation_button') {
$headerContent = '<strong>' . $parentObject->CType_labels[$row['CType']] . '</strong><br/>';
$itemContent .= '<strong>Text:</strong> ' . $parentObject->linkEditContent($parentObject->renderText($row['texting']), $row) . '<br />';
$itemContent .= '<strong>Link:</strong> ' .$parentObject->linkEditContent($parentObject->renderText($row['linking']), $row) . '<br />';
$drawItem = false;
}
}
}
最诚挚的问候,
Aristeidis Karavas
答案 0 :(得分:1)
有后端CSS API:https://docs.typo3.org/typo3cms/SkinningReference/BackendCssApi/SkinningApi/Index.html
您应该可以通过以下方式将CSS注入后端:
$GLOBALS['TBE_STYLES']['stylesheet'] = 'EXT:your/file/location.css';