Implemented: EZP-23289: Add view parameter support to layout module views #284
...the original request view parameters are available to templates within the context of the original request
Hello eZ Community and eZ Crew!
This solution allows normal requests to modules which support the use of the eZModule:STATUS_RERUN feature provided in the default index.php to provide access to the view parameters of the original request for use within any of the templates of the original request.
This allows module views provide within the context of an extension to support view parameters within module views which make use of the eZModule:STATUS_RERUN functionality provided within the index.php.
Without this functionality view parameters are not supported within the context of custom module view extensions using the eZModule:STATUS_RERUN functionality by default.
This poses some problems for custom modules trying to support the same view parameter usage within templates used within one module view's context within another very similar module regardless of the use of the eZModule :STATUS_RERUN functionality.
A prime example this problem is the use of view_parameters within templates used by the content/view module view by default while the layout/set module view's use of the eZModule:STATUS_RERUN functionality currently prevents use of the view parameters provided by the request to layout/set URL.
If you wanted to use the same templates and view parameters for requests to the layout/set module view then this solution may be helpful you and others developers.
Please note that this solution requires no changes to any existing modules, module views or any other code to provide the support desired in the above described use case(s). The problem is isolated to a very specific feature of the eZModule class within the default eZ Publish index file, index.php
This use case can come up when users wish to link to a 'printer friendly' layout of say an 'article' content object (display all pages of an article in one page for example) with the same view parameters as the original request (to view the article using the default pagelayout) URL. Without this solution view parameters are simply unavailable to the templates within this request context.
This is a frustrating inconsistency that leads users to use custom templates, template operators and ultimately GET/POST request variables which are all fine but much less friendly to the view parameter support we have all come to respect, enjoy using and ultimately (good or bad) expect within the template context of most template usage use cases.
The use of GET/POST variables as always is retained after use of the provided pull request, yet additionally if your request provided view parameters, those are also now available for your use within the original requests templates as well.
Additionally if your custom module makes use of the eZModule:STATUS_RERUN feature (like modified copies of the default layout module or other similar such module as an easily understood example) they would automatically have access to the view parameters provided within the context of the original request as well. With no code changes required to your existing module view or templates. Though re-factoring to support this feature within your custom templates may be required to make use of the view parameters that would be then provided / available.
Again we would not request this change for inclusion into eZ Publish master if we did not truly believe that the additions of these improvements represent an important standardization of view parameters support within templates despite the module's use of the eZModule:STATUS_RERUN feature.
Note: Before considering a pull request we took the time to ask more than three other expert eZ Publish developers in the eZ Community to review this patch and share their opinions of the changes. All the eZ Publish developers strongly urged us to send these changes as a pull request back to the eZ Publish master repository. Which we are doing here now with this pull request on their / our combined behalf.
Please let us know directly if there are any further improvements or refinements we can make to this solution / pull request in order to reach approval of these improvements to module view parameter support back into the eZ Publish everyone loves so much.
Thank you for your continued support and support of the eZ Community!
This is our first public eZ Publish / eZ Community related pull request back to the original project master repository please understand if we have made mistakes within the bounds of this our first time making such a request. We seek to help the user and developers but we may make mistakes. Simply help us understand and we will do our very best to improve right away.
Note: Brookins Consulting has long ago (and on more than one occasion) provided a signed and registered CLA with eZ Systems AS
Thank you for your contribution! I hope it is just the first of many to come. Sorry for the delay on processing this; the Community Project Board is trying to refine the system so things move ahead more smoothly, and of course the current feature freeze period doesn't help. Thanks too for the great documentation explaining the new code.
Peace and all good,
We have updated and refactored our original pull request commit content to use the very latest version of the code.
You can review our new commit changes here: https://github.com/ezsystems/ezpublish-legacy/pull/284/files
As we said in our issue ticket description...We'll be brief this time around.
We were verbose in our first introduction of this feature back in 2012 and that didn't help anyone. To read our original introduction please read this pull request title and first comment: #284 (comment)
In short: eZ Publish layout/set module view has lacked view parameter support.
This creates serious template variable conflicts for existing content view templates.
It does this by providing view parameters to other module views which make use of eZModule:STATUS_RERUN requests ie: custom modules or modified copies of the layout module in extensions.
Thank you for your continued support!
First off, thank you for taking the time to review and comment on our first pull request! It really means a lot to us here at BC.
Second, Some apologies are in order. It's been quite some time since we last tested this patch. And your comments are right.
More over it seems this pull request is no longer needed. View parameters are indeed already available within the layout/set module view pagelayout and content view templates after all.
Either something wonderful has changed in the last two and a half years ago since we last tested or we were mistaken to begin with.
Either way. We will test harder before submitting our next pull request. Thanks again and apologies for the trouble.
So in any case. This pull request can be closed.