Project

General

Profile

Actions

Feature #93642

open

New InvokableEnhancer

Added by Rune Piper over 3 years ago. Updated 7 months ago.

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

0%

Estimated time:
PHP Version:
Tags:
Complexity:
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 over 3 years ago

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

Updated by Daniel Siepmann over 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 about 2 years 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 over 1 year ago

  • Sprint Focus deleted (On Location Sprint)
Actions #5

Updated by Oliver Hader 7 months ago

  • Tracker changed from Bug to Feature
  • TYPO3 Version deleted (11)
Actions

Also available in: Atom PDF