Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23510

Add support for overriding ez_page controller with block override rules

    Details

      Description

      Sometimes, we require a special controller action to be able to fully implement some blocks.

      Considering that you can have many places where you can call subrequests to render your blocks, current situation of requiring custom controllers to be defined directly in subrequest call is quite inefficient.

      This pull request adds the possiblity to specify which controller will be called for a specific block view match, much like defining custom controllers for location view or content view match.

      Also, since there are two possible actions with which one can view a block: ez_page:viewBlock and ez_page:viewBlockById, this pull request also makes it possible to specify a controller action with a signature matching either one of original actions.

      Example of configuration in ezpublish/config/ezpublish.yml:

      ezpublish:
          system:
              eng_frontend_group:
                  block_view:
                      ContentGrid:
                          template: NetgenSiteBundle:block:content_grid.html.twig
                          controller: NetgenSiteBundle:Block:viewContentGridBlock
                          match:
                              Type: ContentGrid
      

        Issue Links

          Activity

          Hide
          Rui Silva (Inactive) added a comment -

          [~jerome.vieilledent@ez.no], do you have any insight about this, as to why the suggested configuration is not working?

          Show
          Rui Silva (Inactive) added a comment - [~jerome.vieilledent@ez.no] , do you have any insight about this, as to why the suggested configuration is not working?
          Hide
          Edi Modrić (Inactive) added a comment -

          [~rui.silva@ez.no] There's probably some clashing in block_view override config from demo bundle and your config. Override priorities are probably the cause why it's not working. Try removing the existing ContentGrid overrides from demo budle for test purposes (https://github.com/ezsystems/DemoBundle/blob/master/Resources/config/ezpage.yml#L13-L29)

          P.S. The config for type match needs to be:

          Type: ContentGrid

          and not:

          Type: [ContentGrid]

          Show
          Edi Modrić (Inactive) added a comment - [~rui.silva@ez.no] There's probably some clashing in block_view override config from demo bundle and your config. Override priorities are probably the cause why it's not working. Try removing the existing ContentGrid overrides from demo budle for test purposes ( https://github.com/ezsystems/DemoBundle/blob/master/Resources/config/ezpage.yml#L13-L29 ) P.S. The config for type match needs to be: Type: ContentGrid and not: Type: [ContentGrid]
          Hide
          Rui Silva (Inactive) added a comment -

          @Edi Modrić, thank you for the information, that was in fact what was preventing my configuration to work.
          After removing those lines for the demo override, my block config started working.

          Show
          Rui Silva (Inactive) added a comment - @Edi Modrić, thank you for the information, that was in fact what was preventing my configuration to work. After removing those lines for the demo override, my block config started working.
          Hide
          Rui Silva (Inactive) added a comment -

          Tested and approved by QA.

          Show
          Rui Silva (Inactive) added a comment - Tested and approved by QA.
          Hide
          Eduardo Fernandes (Inactive) added a comment -

          EZP-24136 was created with a backport request for this improvement

          Show
          Eduardo Fernandes (Inactive) added a comment - EZP-24136 was created with a backport request for this improvement

            People

            • Assignee:
              Unassigned
              Reporter:
              Edi Modrić
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 minutes
                5m