Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category menu and news list breaking on same page with frontend routing activated #2250

Open
fsuter opened this issue Nov 1, 2023 · 12 comments

Comments

@fsuter
Copy link

fsuter commented Nov 1, 2023

Bug Report

Current Behavior
I have a page with two news plugins installed: the category menu (CategoryList) and the standard news list (Pi1). When I click on a category, I get the following error:

The controller "News" is not allowed by plugin "CategoryList". Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.

When there's no frontend routing configuration (i.e. no speaking URLs), this does not happen.

I have the following frontend routing configuration:

routeEnhancers:
  NewsPlugin:
    type: Extbase
    namespace: tx_news_pi1
    defaultController: 'News::list'
    routes:
      -
        routePath: '/article/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
      -
        routePath: '/cat/{category-name}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
    aspects:
      news-title:
        type: NewsTitle
      category-name:
        type: NewsCategory

I have tried the configuration from the documentation: https://docs.typo3.org/p/georgringer/news/11.2/en-us/Tutorials/BestPractice/Routing/Index.html#basic-setup-including-categories-tags-and-the-rss-atom-feed and many other variants, all to no avail.

Digging into the Extbase RequestBuilder, where the error happens, I can see that the default values are as expected (pointing to the CategoryController) but they are overridden by the query parameters (which point to the "list" action of the NewsController).

I'm not sure whether this is an Extbase issue, a routing (configuration) issue or really a "news" issue, but at least the extension documentation seem to indicate that two plugins can co-exist on the same page, whereas my current experience shows the contrary.

Expected behavior/output
Being able to the the category menu and the news list on the same page. The category menu should show the active category and the news list should be filtered according to the selected category.

Environment

  • TYPO3 version(s): 12.4.7
  • news version: 11.2.0
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: OSX 14.0
@jramke
Copy link

jramke commented Nov 21, 2023

Im experiencing the same issue with active routeEnhancers, but i dont get the same error message. In my case somehow the detailAction is called an then caught by the handleNoNewsFoundError function.

@jramke
Copy link

jramke commented Dec 8, 2023

I ended up using two different routeEnhancers. One for the detail controller and one for all views with the list controller. Somehow news detail and category list where overwriting each other or something.

routeEnhancers:
  NewsDetail:
    type: Extbase
    extension: News
    plugin: Pi1
    limitToPages:
      - 22
      - 54
    routes:
      -
        routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
    defaultController: 'News::detail'
    aspects:
      news-title:
        type: NewsTitle
  News:
    type: Extbase
    extension: News
    plugin: Pi1
    limitToPages:
      - 9
      # - 22
      - 23
      - 26
      - 14
    routes:
      -
        routePath: '/seite-{page}'
        _controller: 'News::list'
        _arguments:
          page: 'currentPage'
      - 
        routePath: '/{category-name}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
      # -
      #   routePath: '/{news-title}'
      #   _controller: 'News::detail'
      #   _arguments:
      #     news-title: news
      - 
        routePath: '/{tag-name}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      # news-title:
      #   type: NewsTitle
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      category-name:
        type: NewsCategory
      tag-name:
        type: NewsTag

@fsuter
Copy link
Author

fsuter commented Dec 20, 2023

The above configuration does not solve the issue for me. Then again, as @jramke said, he does not have the same error message...

@klodeckl
Copy link

klodeckl commented Jan 23, 2024

I got the same problem, it did cost me really a lot of time. The order is important and the aspect types matter. This is my configuration which works without problems:

  News:
    type: Extbase
    limitToPages:
      - 172
      - 521
      - 3147
      - 2578
      - 635
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
      - routePath: '/{tag-name}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
      - routePath: '/{tag-name}/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
          page: 'currentPage'
      - routePath: '/'
        _controller: 'News::list'
      - routePath: '/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          page: 'currentPage'
      - routePath: '/{category-name}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
      - routePath: '/{category-name}/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
          page: 'currentPage'
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      page-label:
        type: LocaleModifier
        default: 'page'
        localeMap:
          - locale: 'en_GB.*'
            value: 'page'
          - locale: 'de_DE.*'
            value: 'seite'
      category-name:
        type: NewsCategory
      tag-name:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_tag
        routeFieldName: slug

If the order is changed and/or the aspect type it won’t work for either title, category or tag. I think I really tried every combination.
Is this a core or a news issue?

@fsuter
Copy link
Author

fsuter commented Jan 24, 2024

That made me very hopeful, but it still doesn't work for me.

Environment (updated)

TYPO3 version(s): 12.4.10
news version: 11.3.0
Is your TYPO3 installation set up with Composer (Composer Mode): yes
OS: OSX 14.2

@klodeckl
Copy link

Then maybe something is different between TYPO3 11 and 12. What exactly doesn’t work in your case? Did you adjust the ids in limitToPages? It seems that the order is really important and also the used aspect types. Before I switched to news 11 and non-composer mode (I think the important change is update news 10 to 11) ordering and aspect type didn’t matter, no issues.

@klodeckl
Copy link

I just realized my config has one issue: in case of a link with no news/category/tag matching 404 is not fired but message „no news found“. So it seems the system filters news list with no found category or tag. It seems to be a news ext issue in the repository and no core issue.

@fsuter
Copy link
Author

fsuter commented Jan 26, 2024

I did adjust limitToPages and I respected the ordering you suggested. Indeed maybe something is different between TYPO3 11 and 12. I feel like it is rather an Extbase issue (with a relationship to frontend routing).

@klodeckl
Copy link

After updating news from 11.3 to 11.4.1 I had to change the ordering again to get everything working. Here my current working setup:

  News:
    type: Extbase
    limitToPages:
      - 172
      - 521
      - 3147
      - 2578
      - 635
      - 4900
      - 1325
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
      - routePath: '/{tag-name}/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
          page: 'currentPage'
      - routePath: '/{category-name}/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
          page: 'currentPage'
      - routePath: '/{tag-name}'
        _controller: 'News::list'
        _arguments:
          tag-name: overwriteDemand/tags
      - routePath: '/'
        _controller: 'News::list'
      - routePath: '/{page-label}-{page}'
        _controller: 'News::list'
        _arguments:
          page: 'currentPage'
      - routePath: '/{category-name}'
        _controller: 'News::list'
        _arguments:
          category-name: overwriteDemand/categories
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      page-label:
        type: LocaleModifier
        default: 'page'
        localeMap:
          - locale: 'en_GB.*'
            value: 'page'
          - locale: 'de_DE.*'
            value: 'seite'
      category-name:
        type: NewsCategory
      tag-name:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_tag
        routeFieldName: slug

@wdraghwendra
Copy link

I am facing same problem in typo3 version 12.4.x . Any solution on this please suggest?

@Kayu84
Copy link

Kayu84 commented Jul 24, 2024

facing the same issue with CategoryList & NewsList on the same page (TYPO3 v12.4.16 & News v11.4.2):
The controller "News" is not allowed by plugin "CategoryList". Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
image
and checking the Exception:

if (isset($configuration['mvc']['callDefaultActionIfActionCantBeResolved']) && (bool)$configuration['mvc']['callDefaultActionIfActionCantBeResolved']) {
    return $defaultValues->getDefaultControllerClassName();
}
image we solved the issue by setting:
plugin.tx_news_categorylist {
  mvc {
    callDefaultActionIfActionCantBeResolved = 1
  }
}

Just wondering why this isn't set as Default.

@fsuter
Copy link
Author

fsuter commented Aug 9, 2024

Oh great, finally a solution that worked for me! Many thanks @Kayu84

And I agree that this seems like a necessary default setting (which is why I'm leaving this report open for now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants