Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10791

TYPO3: correct slug generation for detail-view

I have this configuration for my enhancement extension of fe_users:

routeEnhancers:
  PhonebookPlugin:
    type: Extbase
    limitToPages:
      - 21
      - 666
    extension: Phonebook
    plugin: tx_phonebook_phonebook
    routes:
      -
        routePath: '/seite/{page}'
        _controller: 'PhonebookItem::list'
        _arguments:
          page: '@widget_0/currentPage'
      -
        routePath: '/detail/{user}'
        _controller: 'PhonebookItem::show'
        _arguments:
          user: 'phonebookItem'
    defaultController: 'PhonebookItem::list'
    defaults:
      page: '0'
    requirements:
      page: '\d+'

but instead of URLs like https:/domain.tld/telefonbuch/seite/7 and https:/domain.tld/telefonbuch/detail/123
the URLs for list-pagination-links look like:
https://domain.tld/telefonbuch?tx_phonebook_phonebook[%40widget_0][currentPage]=7&cHash=0c9036d3c9c4b72d334bb12a8dc2eb74
and for detail view:
https://domain.tld/telefonbuch?tx_phonebook_phonebook%5Baction%5D=show&tx_phonebook_phonebook%5Bcontroller%5D=PhonebookItem&tx_phonebook_phonebook%5Bpage%5D=7&tx_phonebook_phonebook%5BphonebookItem%5D=123&cHash=7cc4e3152cd658e7ee209b05d1bedfab

What configuration is missing or wrong?

Upvotes: 1

Views: 192

Answers (1)

Aristeidis Karavas
Aristeidis Karavas

Reputation: 1956

First of all, unless you haven't intentionally named your plugin tx_phonebook_phonebook then the value is wrong. It should be Phonebook.

Generally you re missing your aspects. Your {variables} have no definition.

aspects:    
   page:
      type: StaticRangeMapper
      start: '1'
      end: '100'
   user:
      type: PersistedPatternMapper
      tableName: fe_users
      routeFieldPattern: '^(?P<username>.+)'
      routeFieldResult: '{username}'

You will have to play around with the table columns. You should pay attention to spaces, special characters capital letters etc. You can always add a slug field on the fe_users and add your own configuration.

Upvotes: 1

Related Questions