【问题标题】:Typo3: MenuProcessor cache configurationTypo3:MenuProcessor 缓存配置
【发布时间】:2021-10-21 09:23:35
【问题描述】:

根据当前的 Typo3 文档,MenuProcessor 使用 HEMNU,因此应该可以在 MenuProcessor 的打字稿中使用 HMENU 的属性。

HMENU 有一个数据类型“缓存”的属性“缓存”,例如允许设置缓存键。

不幸的是,当我将“缓存”分配给 MenuProcessor 时,出现“无效参数”错字3 错误。

我想要达到的目标:

  • 完全禁用我的 MenuProcessor 的缓存

  • 设置唯一的 cache.key

有办法解决吗?

【问题讨论】:

  • 你愿意分享你的代码吗?

标签: typo3 typoscript


【解决方案1】:

MenuProcessor 使用HEMNU,但不支持所有属性。

让我们看看MenuProcessor的代码:

/**
 * Allowed configuration keys for menu generation, other keys
 * will throw an exception to prevent configuration errors.
 *
 * @var array
 */
public $allowedConfigurationKeys = [
    'cache_period',
    'entryLevel',
    'entryLevel.',
    'special',
    'special.',
    'minItems',
    'minItems.',
    'maxItems',
    'maxItems.',
    'begin',
    'begin.',
    'alternativeSortingField',
    'alternativeSortingField.',
    'showAccessRestrictedPages',
    'showAccessRestrictedPages.',
    'excludeUidList',
    'excludeUidList.',
    'excludeDoktypes',
    'includeNotInMenu',
    'includeNotInMenu.',
    'alwaysActivePIDlist',
    'alwaysActivePIDlist.',
    'protectLvar',
    'addQueryString',
    'addQueryString.',
    'if',
    'if.',
    'levels',
    'levels.',
    'expandAll',
    'expandAll.',
    'includeSpacer',
    'includeSpacer.',
    'as',
    'titleField',
    'titleField.',
    'dataProcessing',
    'dataProcessing.',
];

有可能在 TYPO3 v10 中引入 HMENU 的缓存属性时,只是忘记在 MenuProcessor 中允许它...

【讨论】:

  • 所以应该可以通过扩展 MenuProcessor 并将缓存添加到 $allowedConfigurationKeys 数组来创建自定义处理器?
  • 我只是感兴趣并做了一些研究......自定义处理器可能是一个尝试。更好的方法是报告它 - 也许有原因为什么 cache没有被包括在内。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-02-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-11
  • 1970-01-01
相关资源
最近更新 更多