View Issue Details

IDProjectCategoryView StatusLast Update
0007044module Visual CMSmodule Visual CMS - subpublic2022-02-17 12:58
Status confirmedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0007044: PreviewController breaks extension chain
Description   The extension:

    class PreviewController extends ContentController

    breaks the extension chain in oxid.

    ContentController in this case is \OxidEsales\VisualCmsModule\Application\Controller\ContentController which is itself an oxid extension

    class ContentController extends ContentController_parent

    It is possible that it works in some cases but it's nevertheless incorrect.

    Correct should be:

########<Please see the edit below>########
class PreviewController extends \OxidEsales\Eshop\Application\Controller\ContentController

which makes the both VCMS extensions active.
########</Please see the edit below>########

Edit by QA:
The VCMS\PreviewController inherits from the VCMS\ContentController. So this is completely isolated in the module functionality itself and mostly a decision of the code design.
But best practise would be to inherit from a "parent" and not directly from a controller, therefore you can create a module of a module. So I declare this entry as a feature request, to make the module code more "smooth".

That means:

  class PreviewController extends ContentController

  should be replaced by

  class PreviewController extends PreviewController_parent

and the metadata.php should contain such an entry in the extends array:

  \OxidEsales\VisualCmsModule\Application\Controller\ContentController::class => \OxidEsales\VisualCmsModule\Application\Controller\PreviewController::class,

[end of edit]

TagsNo tags attached.



2019-11-05 10:55

administrator   ~0013033



2021-09-23 12:52

reporter   ~0013486

The PreviewController is declared as a module controller - that's absolutely fine, in my opinion, because it adds functionality only for the preview. It just needs to extend the base OXID \OxidEsales\Eshop\Application\Controller\ContentController class, so the extension chain stays intact, as mentioned by @ckurz

The small change would fix it and everyone would be happy.

-> source/modules/ddoe/visualcms/Application/Controller/PreviewController.php
class PreviewController extends ContentController
class PreviewController extends \OxidEsales\Eshop\Application\Controller\ContentController


2022-02-17 12:58

reporter   ~0013780

I would suggest to move the preview functionality directly into ContentController as e.g. fnc=preview
That way extensions to ContentController (that the cms content may rely on) will also work when previewing

If using "PreviewController extends PreviewController_parent" the PreviewControllers render() would need to determine somehow if it should be previewing or just passing thru to parent::render()