限制页面媒体 allowedExtensions TYPO3 9.5.x

Restrict page media allowedExtensions TYPO3 9.5.x

我如何限制 allowedExtention 仅用于 $GLOBALS['TCA']['pages']['columns']['media']?但不要使用 $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],因为它会增加对所有 FAL 字段的限制。

我找到了class

class ImageManipulationElement extends AbstractFormElement
{
    /**
     * Default element configuration
     *
     * @var array
     */
    protected static $defaultConfig = [
        'file_field' => 'uid_local',
        'allowedExtensions' => null, // default: $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']

看起来应该是这样的:

$GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['allowedExtensions'] = 'jpg, jpeg';

艰难的道路将放弃这个领域的所有有用的东西。

$GLOBALS['TCA']['pages']['columns']['media'] = [
             'exclude' => true,
             'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.media',
             'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                 'media',
                 [], 'jpg, jpeg'
             )
         ]; 

所以不是我们的方式。我只需要一些覆盖,例如

$GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['columns']...['allowedExtention'] = 'jpg, jpeg';

谁知道怎么做?

经过小小的搜索,我找到了这个例子:

$allowExtensions = 'jpg,jpeg';
$GLOBALS['TCA']['pages']['columns']['media']['config']['filter'][0]['parameters']['allowedFileExtensions'] = '$allowExtensions; 
$GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['columns']['uid_local']['config']['appearance']['elementBrowserAllowed']= $allowExtensions;

已添加到 typo3conf/ext/myext/Configuration/TCA/Overrides/pages。php