TYPO3 将文件元数据添加到后端 TCA IRRE 元素
TYPO3 add filemetadata to backend TCA IRRE element
我想在 tt_content(TYPO3 8.7 中的标准 IRRE 字段)中的图像中添加额外的元数据(例如版权)。
我安装了 "filemetadata" 扩展来获取这些附加字段。如果我打开 sys_file_reference,我可以访问这些字段。现在我想向 tt_content IRRE "image" 字段显示版权字段,该字段当前显示的是标准字段"title,description,link".
我试图覆盖 TCA (myExtension/Configuration/TCA/Override/tt_content.php):
'image' => [
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', [
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
// custom configuration for displaying fields in the overlay/reference table
// to use the imageoverlayPalette instead of the basicoverlayPalette
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => 'copyright,
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
copyright,--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.audioOverlayPalette;audioOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.videoOverlayPalette;videoOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
],
], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
],
并在 myExtension 的 localconf 中像这样:
$GLOBALS['TCA']['sys_file_reference']['types'] =[
'0' => array('showitem' => 'uid_local,uid_foreign,tablenames,fieldname,title,description,copyright'),
];
但版权字段不会出现。
请帮忙
$GLOBALS['TCA']['sys_file_reference']['ctrl']['types']
应该是
$GLOBALS['TCA']['sys_file_reference']['types']
不确定是否还有其他问题。
我找到了一个肮脏的解决方案。
主要问题是 sys_file_metadata 与 sys_file_reference!
无关
我解决了我的问题:
- TCA 中的新 UserFunc sys_file_reference na dset 新调色板
EXT:myext/Configuration/TCA/Overrides/sys_file_reference.php:
$metaDataSysFileReferenceColumns = [
'metadata' => array (
'exclude' => 1,
'label' => 'Metadata',
'config' => array (
'type' => 'user',
'userFunc' => \VENDOR\MyExt\UserFunction\ProviderField::class . '->getMetaData',
)
)];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $metaDataSysFileReferenceColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('sys_file_reference', 'metaPalette', 'metadata');
用户函数 ProviderField->getMetaData()
public 函数 getMetaData(数组 $parameters,$parentObject)
{
$uid = $parameters['row']['uid_local'][0]['uid'];
$sys_language_uid = 0;
if (!empty($parameters['row']['sys_language_uid'])) {
$sys_language_uid = $parameters['row']['sys_language_uid'][0];
}
$queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getQueryBuilderForTable('sys_file_metadata');
$recordInDatabase = $queryBuilder
->select('*')
->from('sys_file_metadata')
->where(
$queryBuilder->expr()->eq(
'file',
$queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
),
$queryBuilder->expr()->eq(
'sys_language_uid',
$queryBuilder->createNamedParameter($sys_language_uid, \PDO::PARAM_INT)
)
)
->setMaxResults(1)
->execute()
->fetch();
$html = array();
$html[] = '
<div class="row">
<div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6">
<label class="t3js-formengine-label">
Creator
</label>
<div class="formengine-field-item t3js-formengine-field-item">
<div class="form-control-wrap" style="max-width: 480px">
<div class="form-wizards-wrap">
<div class="form-wizards-element">
<div class="form-control-clearable">
<input type="text" id="formengine-input-'.uniqid().'"
class="form-control t3js-clearable hasDefaultValue"
data-formengine-validation-rules="[{"type":"trim"}]"
data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]","evalList":"trim","is_in":""}"
data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]"
data-formengine-input-initialized="true">
<button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path>
</svg>
</span>
</span>
</button>
</div>
<input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]" value="'.$recordInDatabase['creator'].'">
</div>
<div class="form-wizards-items-aside">
<div class="btn-group"></div>
</div>
<div class="form-wizards-items-bottom"></div>
</div>
</div>
</div>
</div>
<div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6">
<label class="t3js-formengine-label">
Source
</label>
<div class="formengine-field-item t3js-formengine-field-item">
<div class="form-control-wrap" style="max-width: 480px">
<div class="form-wizards-wrap">
<div class="form-wizards-element">
<div class="form-control-clearable">
<input type="text" id="formengine-input-'.uniqid().'"
class="form-control t3js-clearable hasDefaultValue"
data-formengine-validation-rules="[{"type":"trim"}]"
data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]","evalList":"trim","is_in":""}"
data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]"
data-formengine-input-initialized="true">
<button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path>
</svg>
</span>
</span>
</button>
</div>
<input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]" value="'.$recordInDatabase['source'].'">
</div>
<div class="form-wizards-items-aside">
<div class="btn-group"></div>
</div>
<div class="form-wizards-items-bottom"></div>
</div>
</div>
</div>
</div>
<div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6">
<label class="t3js-formengine-label">
Copyright
</label>
<div class="formengine-field-item t3js-formengine-field-item">
<div class="form-control-wrap" style="max-width: 480px">
<div class="form-wizards-wrap">
<div class="form-wizards-element">
<div class="form-control-clearable">
<input type="text" id="formengine-input-'.uniqid().'"
class="form-control t3js-clearable hasDefaultValue"
data-formengine-validation-rules="[{"type":"trim"}]"
data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]","evalList":"trim","is_in":""}"
data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]"
data-formengine-input-initialized="true">
<button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path>
</svg>
</span>
</span>
</button>
</div>
<input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]" value="'.$recordInDatabase['copyright'].'">
</div>
<div class="form-wizards-items-aside">
<div class="btn-group"></div>
</div>
<div class="form-wizards-items-bottom"></div>
</div>
</div>
</div>
</div>
<div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6">
<label class="t3js-formengine-label">
Publisher
</label>
<div class="formengine-field-item t3js-formengine-field-item">
<div class="form-control-wrap" style="max-width: 480px">
<div class="form-wizards-wrap">
<div class="form-wizards-element">
<div class="form-control-clearable">
<input type="text" id="formengine-input-'.uniqid().'"
class="form-control t3js-clearable hasDefaultValue"
data-formengine-validation-rules="[{"type":"trim"}]"
data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]","evalList":"trim","is_in":""}"
data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]"
data-formengine-input-initialized="true">
<button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;">
<span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path>
</svg>
</span>
</span>
</button>
</div>
<input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]" value="'.$recordInDatabase['publisher'].'">
</div>
<div class="form-wizards-items-aside">
<div class="btn-group"></div>
</div>
<div class="form-wizards-items-bottom"></div>
</div>
</div>
</div>
</div>
</div>';
return implode(LF, $html);
}
最后一步覆盖 tt_content 中的资产 (FileReference):
EXT:myext/Configuration/TCA/Overrides/tt_content.php:
'assets' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', [
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references.addFileReference'
],
// 在 overlay/reference table 中显示字段的自定义配置
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;newsPalette,
--调色板--;;imageoverlayPalette,
--调色板--;;文件调色板'
]
],
],
], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext'])
],
瞧,tt_content 中的每个媒体元素都将显示有关折叠 IRRE 的附加元数据信息。我知道,真的很脏...
我想在 tt_content(TYPO3 8.7 中的标准 IRRE 字段)中的图像中添加额外的元数据(例如版权)。
我安装了 "filemetadata" 扩展来获取这些附加字段。如果我打开 sys_file_reference,我可以访问这些字段。现在我想向 tt_content IRRE "image" 字段显示版权字段,该字段当前显示的是标准字段"title,description,link".
我试图覆盖 TCA (myExtension/Configuration/TCA/Override/tt_content.php):
'image' => [
'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', [
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
// custom configuration for displaying fields in the overlay/reference table
// to use the imageoverlayPalette instead of the basicoverlayPalette
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => 'copyright,
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
copyright,--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.audioOverlayPalette;audioOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.videoOverlayPalette;videoOverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
],
], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
],
并在 myExtension 的 localconf 中像这样:
$GLOBALS['TCA']['sys_file_reference']['types'] =[
'0' => array('showitem' => 'uid_local,uid_foreign,tablenames,fieldname,title,description,copyright'),
];
但版权字段不会出现。 请帮忙
$GLOBALS['TCA']['sys_file_reference']['ctrl']['types']
应该是
$GLOBALS['TCA']['sys_file_reference']['types']
不确定是否还有其他问题。
我找到了一个肮脏的解决方案。 主要问题是 sys_file_metadata 与 sys_file_reference!
无关我解决了我的问题:
- TCA 中的新 UserFunc sys_file_reference na dset 新调色板
EXT:myext/Configuration/TCA/Overrides/sys_file_reference.php:
$metaDataSysFileReferenceColumns = [
'metadata' => array (
'exclude' => 1,
'label' => 'Metadata',
'config' => array (
'type' => 'user',
'userFunc' => \VENDOR\MyExt\UserFunction\ProviderField::class . '->getMetaData',
)
)]; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $metaDataSysFileReferenceColumns); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('sys_file_reference', 'metaPalette', 'metadata');
用户函数 ProviderField->getMetaData() public 函数 getMetaData(数组 $parameters,$parentObject) {
$uid = $parameters['row']['uid_local'][0]['uid']; $sys_language_uid = 0; if (!empty($parameters['row']['sys_language_uid'])) { $sys_language_uid = $parameters['row']['sys_language_uid'][0]; } $queryBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class) ->getQueryBuilderForTable('sys_file_metadata'); $recordInDatabase = $queryBuilder ->select('*') ->from('sys_file_metadata') ->where( $queryBuilder->expr()->eq( 'file', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT) ), $queryBuilder->expr()->eq( 'sys_language_uid', $queryBuilder->createNamedParameter($sys_language_uid, \PDO::PARAM_INT) ) ) ->setMaxResults(1) ->execute() ->fetch(); $html = array(); $html[] = ' <div class="row"> <div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6"> <label class="t3js-formengine-label"> Creator </label> <div class="formengine-field-item t3js-formengine-field-item"> <div class="form-control-wrap" style="max-width: 480px"> <div class="form-wizards-wrap"> <div class="form-wizards-element"> <div class="form-control-clearable"> <input type="text" id="formengine-input-'.uniqid().'" class="form-control t3js-clearable hasDefaultValue" data-formengine-validation-rules="[{"type":"trim"}]" data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]","evalList":"trim","is_in":""}" data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]" data-formengine-input-initialized="true"> <button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close"> <span class="icon-markup"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> <path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path> </svg> </span> </span> </button> </div> <input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][creator]" value="'.$recordInDatabase['creator'].'"> </div> <div class="form-wizards-items-aside"> <div class="btn-group"></div> </div> <div class="form-wizards-items-bottom"></div> </div> </div> </div> </div> <div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6"> <label class="t3js-formengine-label"> Source </label> <div class="formengine-field-item t3js-formengine-field-item"> <div class="form-control-wrap" style="max-width: 480px"> <div class="form-wizards-wrap"> <div class="form-wizards-element"> <div class="form-control-clearable"> <input type="text" id="formengine-input-'.uniqid().'" class="form-control t3js-clearable hasDefaultValue" data-formengine-validation-rules="[{"type":"trim"}]" data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]","evalList":"trim","is_in":""}" data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]" data-formengine-input-initialized="true"> <button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close"> <span class="icon-markup"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> <path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path> </svg> </span> </span> </button> </div> <input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][source]" value="'.$recordInDatabase['source'].'"> </div> <div class="form-wizards-items-aside"> <div class="btn-group"></div> </div> <div class="form-wizards-items-bottom"></div> </div> </div> </div> </div> <div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6"> <label class="t3js-formengine-label"> Copyright </label> <div class="formengine-field-item t3js-formengine-field-item"> <div class="form-control-wrap" style="max-width: 480px"> <div class="form-wizards-wrap"> <div class="form-wizards-element"> <div class="form-control-clearable"> <input type="text" id="formengine-input-'.uniqid().'" class="form-control t3js-clearable hasDefaultValue" data-formengine-validation-rules="[{"type":"trim"}]" data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]","evalList":"trim","is_in":""}" data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]" data-formengine-input-initialized="true"> <button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close"> <span class="icon-markup"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> <path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path> </svg> </span> </span> </button> </div> <input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][copyright]" value="'.$recordInDatabase['copyright'].'"> </div> <div class="form-wizards-items-aside"> <div class="btn-group"></div> </div> <div class="form-wizards-items-bottom"></div> </div> </div> </div> </div> <div class="form-group t3js-formengine-validation-marker t3js-formengine-palette-field col-sm-6"> <label class="t3js-formengine-label"> Publisher </label> <div class="formengine-field-item t3js-formengine-field-item"> <div class="form-control-wrap" style="max-width: 480px"> <div class="form-wizards-wrap"> <div class="form-wizards-element"> <div class="form-control-clearable"> <input type="text" id="formengine-input-'.uniqid().'" class="form-control t3js-clearable hasDefaultValue" data-formengine-validation-rules="[{"type":"trim"}]" data-formengine-input-params="{"field":"data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]","evalList":"trim","is_in":""}" data-formengine-input-name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]" data-formengine-input-initialized="true"> <button type="button" class="close" tabindex="-1" aria-hidden="true" style="display: none;"> <span class="t3js-icon icon icon-size-small icon-state-default icon-actions-close" data-identifier="actions-close"> <span class="icon-markup"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> <path d="M11.9 5.5L9.4 8l2.5 2.5c.2.2.2.5 0 .7l-.7.7c-.2.2-.5.2-.7 0L8 9.4l-2.5 2.5c-.2.2-.5.2-.7 0l-.7-.7c-.2-.2-.2-.5 0-.7L6.6 8 4.1 5.5c-.2-.2-.2-.5 0-.7l.7-.7c.2-.2.5-.2.7 0L8 6.6l2.5-2.5c.2-.2.5-.2.7 0l.7.7c.2.2.2.5 0 .7z" class="icon-color"></path> </svg> </span> </span> </button> </div> <input type="hidden" name="data[sys_file_metadata]['.$recordInDatabase['uid'].'][publisher]" value="'.$recordInDatabase['publisher'].'"> </div> <div class="form-wizards-items-aside"> <div class="btn-group"></div> </div> <div class="form-wizards-items-bottom"></div> </div> </div> </div> </div> </div>'; return implode(LF, $html);
}
最后一步覆盖 tt_content 中的资产 (FileReference): EXT:myext/Configuration/TCA/Overrides/tt_content.php: 'assets' => [ 'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references', 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', [ 'appearance' => [ 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references.addFileReference' ], // 在 overlay/reference table 中显示字段的自定义配置 'overrideChildTca' => [ 'types' => [ '0' => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;metaPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ 'showitem' => ' --调色板--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;newsPalette, --调色板--;;imageoverlayPalette, --调色板--;;文件调色板' ] ], ], ], $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']) ],
瞧,tt_content 中的每个媒体元素都将显示有关折叠 IRRE 的附加元数据信息。我知道,真的很脏...