Project

General

Profile

Actions

Bug #93642

open

New InvokableEnhancer

Added by Rune Piper about 3 years ago. Updated 9 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
Link Handling, Site Handling & Routing
Start date:
2021-03-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I was wondering if it is possible to create an InvokableEnhancer to reduce configuration overhead. E.g. for dynamic JSON files you have to create a PAGE cObject and add the mapping (pageNum => route name) to the site configuration. I think it would by easier by creating a new RouteEnhancer that will invoke a controller. The site configuration could look like this:

routeEnhancers:
  Invokables:
    type: Invokable
    extension: SomeNiceExtension
    routes:
      - {routePath: 'some-file.json', _controller: 'Foo'}
      - {routePath: 'another-file.json', _controller: 'Bar'}

You can then easily create a controller like the following:
class Foo
{
  public function __invoke(): ResponseInterface
  {
    return new JsonResponse($someJson);
  }
}

This would remove all the TypoScript and plugin configuration.

Actions #1

Updated by Daniel Siepmann almost 3 years ago

  • Category changed from Extbase to Link Handling, Site Handling & Routing
Actions #2

Updated by Daniel Siepmann almost 3 years ago

I like the idea, still we didn't have the use case yet.
It is possible to register your own Enhancer (https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Routing/ExtendingRouting.html#writing-custom-enhancers). One could build such an enhancer and provide it as an 3rd party extension and / or patch for TYPO3.

Actions #3

Updated by Oliver Hader over 1 year ago

  • Status changed from New to Needs Feedback
  • Assignee set to Oliver Hader
  • Sprint Focus set to On Location Sprint

I like the idea, unfortunately it works a bit different in TYPO3. Maybe I've time next week to think about that further...

Actions #4

Updated by Benni Mack 9 months ago

  • Sprint Focus deleted (On Location Sprint)
Actions

Also available in: Atom PDF