View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007044 | module Visual CMS | module Visual CMS - sub | public | 2019-10-31 14:09 | 2024-11-18 16:39 |
Reporter | ckurz | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Fixed in Version | 5.0.0 | ||||
Summary | 0007044: PreviewController breaks extension chain | ||||
Description | The extension: ddoe/VCMS\OxidEsales\VisualCmsModule\Application\Controller\PreviewController 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] | ||||
Tags | No tags attached. | ||||
|
-MK |
|
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 change class PreviewController extends ContentController to class PreviewController extends \OxidEsales\Eshop\Application\Controller\ContentController |
|
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() |