FluidTYPO3 / flux

TYPO3 extension Flux: Dynamic Fluid FlexForms
https://fluidtypo3.org
145 stars 214 forks source link

PageController not intialiased #1848

Closed deivibub closed 2 years ago

deivibub commented 4 years ago

Hi there,

I'm using TYPO3 10.4.9 with flux 9.4.2 and registered the controllers

if(class_exists(\FluidTYPO3\Flux\Core::class)){
  \FluidTYPO3\Flux\Core::registerProviderExtensionKey('Oyc.OycTemplate', 'Content');
  \FluidTYPO3\Flux\Core::registerProviderExtensionKey('Oyc.OycTemplate', 'Page');
}

ContentController actions get invoked corresponding to the names of the template files, but having a page template with the name "Standard.html" an action called "standardAction" never gets invoked.

Am I missing something here?

Thank you

NamelessCoder commented 4 years ago

Class loading may be incorrectly configured, your PageController's namespace may be incorrect (case sensitivity may apply) or there may be a typo in the class name or file. You should be able to check this by debugging class_exists($yourPageControllerClassName) somewhere else, which would verify if class loading works.

deivibub commented 4 years ago

Thank you @NamelessCoder

I checked inside an action of the ContentController and it returned true.

I'm using my provider since flux version 8.2.1 with fluidcontent and fluidpages installed as well (that time). Could there be a migration issue, something I've overseen?

Thank you

typoworx-de commented 3 years ago

I've also experienced some problems. I also noticed neither the "myAction" nor the "initializeAction" methods are invoked. But if you simply need to add some Variables, try overriding like this:

<?php
namespace TYPOworx\FooBar\Controller;

use FluidTYPO3\Flux\Controller\PageController as FluxPageController;

/**
 * Class PageController
 * @package TYPOworx\FooBar\Controller
 * @route off
 */
class PageController extends FluxPageController
{
    use ContentDataProcessorTrait;

    protected function initializeViewVariables()
    {
        parent::initializeViewVariables();
        this->view->assign('foo', 'bar'); // modify to your needs
    }
}
NamelessCoder commented 2 years ago

I think this problem was solved with commit https://github.com/FluidTYPO3/flux/commit/19279684f1792f373d3a1fafdbde4dea0e4e12d9 (currently only in the development branch) - but it would be great if you could confirm!

Side note: if you need specific variables within your templates this can also be done by creating a ViewHelper that reads the variables and assigns them into the VariableProvider via RenderingContext, e.g.:

$renderingContext->getVariableProvider()->add('myvariable', 'myvalue');

Or if a ViewHelper already exists which returns the right variable, the output of such a ViewHelper can be assigned as a template variable through this Fluid syntax:

{my:variableViewHelper() -> f:variable(name: 'myvariable')}
NamelessCoder commented 2 years ago

Closing as "part unexplained, part solved, part by-design and has workarounds".

For anyone interested: