calien/extended-routing

TYPO3 扩展路由映射器

安装: 880

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 2

类型:typo3-cms-extension

1.0.0 2022-04-07 08:06 UTC

This package is auto-updated.

Last update: 2024-09-05 05:56:37 UTC


README

#扩展路由方面

它做什么?

为 TYPO3 路由方面特性添加了一些额外的映射器。

它是如何工作的?

使用四个新的路由方面,您可以在 TYPO3 中处理更高级的路由可能性。

映射器

DateTimeMapper

允许您创建自定义 URL 部分,包括本地化以获取 DateTime 值,而无需使用具有定义 slug 的数据集。

Archive:
  type: Extbase
  extension: News
  plugin: Archive
  routes:
    - routePath: '/{day}'
      _controller: 'Archive::list'
      _arguments:
        day: day
  defaultController: 'Archive::list'
  aspects:
    day:
      type: DateTimeMapper
      format: Y-m-d
      localeFormat:
        -
          locale: 'de_.*'
          format: d-m-Y

PersistedSanitizedPatternMapper

添加一个新的路由方面,扩展了 TYPO3 核心的 PersistedPatternMapper,使用净化后的 URL 部分。如果需要,将尊重本地化。

aspects:
  country:
    type: PersistedSanitizedPatternMapper
    tableName: static_countries
    routeFieldPattern: '^(.*)-(?P<uid>\d+)$'
    routeFieldResult: '{cn_short_de|sanitized}-{uid}'
    localeMap:
      - locale: 'de_*'
        field: cn_short_de
      - locale: 'en_*'
        field: cn_short_en
  territory:
    type: PersistedSanitizedPatternMapper
    tableName: static_territories
    routeFieldPattern: '^(.*)-(?P<uid>\d+)$'
    routeFieldResult: '{tr_name_de|sanitized}-{uid}'
    localeMap:
      - locale: 'de_*'
        field: tr_name_de
      - locale: 'en_*'
        field: tr_name_en

PersistedDisabledAliasMapper

允许通过 TCA enablecolumns 创建已禁用元素的完整 URL。如果您在发布记录之前必须创建 URL,则很有用。用法与默认的 PersistedAliaMapper 相同。

News:
  type: Extbase
  extension: News
  plugin: news
  routes:
    -
      routePath: '/{title}'
      _controller: 'News::single'
      _arguments:
        title: news
  aspects:
    title:
      type: PersistedDisabledliasMapper
      tableName: tx_news_domain_model_news
      routeFieldName: path_segment

PersistedNullableAliasMapper

允许为通常具有别名的 URL 路径段提供默认值。例如,没有类别的新闻,但 URL 部分定义为具有类别。

News:
  type: Extbase
  extension: News
  plugin: News
  routes:
    -
      routePath: '/{category}/{title}'
      _controller: 'News::single'
      _arguments:
        category: category
        title: news
  aspects:
    category:
      type: PersistedNullableAliasMapper
      default: 'no-category'
      tableName: tx_news_domain_model_category
      routeFieldName: path_segment
    title:
      type: PersistedAliasMapper
      tableName: tx_news_domain_model_news
      routeFieldName: path_segment

安装

可通过 extensions.typo3.org、ZIP 上传或 composer 完成。

扩展存储库

https://extensions.typo3.org/extension/extended_routing

Composer

composer require calien/extended-routing