magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

M 2.4.0 Contact Form has error and can't be rendered #29357

Closed bluedarter2 closed 3 years ago

bluedarter2 commented 4 years ago

Preconditions (*)

  1. Debian 10, Apache 2.4, PHP 7.3.19, mysql Ver 15.1 Distrib 10.3.22-MariaDB Initially using Magento 2.3, with Magento Blank theme and no sample data or customized code. Had the start of a store, with basic data. The "Contact Us" footer link was basic, but worked fine.

  2. After upgrade from Magento 2.3.5-p1 to Magento 2.4.0, the form does not render and generates an error.

Steps to reproduce (*)

  1. Using vanilla Magento 2.3.5-p1, upgraded to 2.4.0. NO customizations, almost no data, just basic store info, contact info, and the following in the "Contact Us" CONTENT-> Pages page:
    <div style="float: left; padding-right: 15px;">
    <p>Need some help? We'd love to hear from you!</p>
    <p>Call us: 503-555-1212</p>
    <p><img src="{{media url="woman-typing.jpg"}}" alt="" width="297" height="198">;</p>
    </div>
    <p>{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}</p>
  2. View front-end "Customer View",
  3. click on the "Contact Us" footer link

Expected result (*)

  1. I expect to see the basic blank theme Contact Us form

Actual result (*)

  1. The page renders like this: Screenshot from 2020-07-30 11-11-02

The error is as follows:

<input name="name" id="name" title="Name" value="Error: Call to a member function getUserName() on null in /var/www/html/magento/vendor/magento/module-contact/view/frontend/templates/form.phtml:29
Stack trace:
#0 /var/www/html/magento/vendor/magento/framework/View/TemplateEngine/Php.php(71): include()
#1 /var/www/html/magento/vendor/magento/framework/View/Element/Template.php(273): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Contact\Block\ContactForm), '/var/www/html/m...', Array)
#2 /var/www/html/magento/vendor/magento/framework/View/Element/Template.php(303): Magento\Framework\View\Element\Template->fetchView('/var/www/html/m...')
#3 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(1111): Magento\Framework\View\Element\Template->_toHtml()
#4 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(1115): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#5 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(675): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#6 /var/www/html/magento/vendor/magento/module-email/Model/Template/Filter.php(426): Magento\Framework\View\Element\AbstractBlock->toHtml()
#7 [internal function]: Magento\Email\Model\Template\Filter->blockDirective(Array)
#8 /var/www/html/magento/vendor/magento/framework/Filter/DirectiveProcessor/LegacyDirective.php(42): ReflectionMethod->invokeArgs(Object(Magento\Widget\Model\Template\Filter), Array)
#9 /var/www/html/magento/vendor/magento/framework/Filter/Template.php(184): Magento\Framework\Filter\DirectiveProcessor\LegacyDirective->process(Array, Object(Magento\Widget\Model\Template\Filter), Array)
#10 /var/www/html/magento/vendor/magento/module-email/Model/Template/Filter.php(1080): Magento\Framework\Filter\Template->filter('<div style=" flo...')="" #11="" var="" www="" html="" magento="" vendor="" module-cms="" block="" page.php(170):="" magento\email\model\template\filter-="">
m2-assistant[bot] commented 4 years ago

Hi @bluedarter2. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

bluedarter2 commented 4 years ago

I did a separate new install of Magento 2.4.0, and out of the box the Contact Us form works correctly. This must be an upgrade bug. This makes me really worry about choosing Magento for my new online store.

mrtuvn commented 4 years ago

@bluedarter2 not sure how do you update but i upgrade direct from 2.3.5-p1 to 2.4.0 by composer way Screenshot from 2020-08-01 16-48-29

Can't reproduce issue Also double check composer.json have this require "magento/composer-root-update-plugin": "~1.0"

"require": { "magento/product-community-edition": "2.4.0", "magento/composer-root-update-plugin": "~1.0" }

Lastly when you update 2.4.0 magento require elastic search service must setup

You also need update your magento instance config

bin/magento config:set catalog/search/engine elasticsearch7 bin/magento config:set catalog/search/enable_eav_indexer 1 bin/magento config:set catalog/search/elasticsearch7_server_hostname elasticsearch bin/magento config:set catalog/search/elasticsearch7_server_port 9200 bin/magento config:set catalog/search/elasticsearch7_index_prefix magento2 bin/magento config:set catalog/search/elasticsearch7_enable_auth 0 bin/magento config:set catalog/search/elasticsearch7_server_timeout 15

update elasticsearch7_server_hostname with your value

bluedarter2 commented 4 years ago

@mrtuvn I used composer to do the upgrade, per the magento 2.4 upgrade instructions. I had already installed elasticsearch 7.8.1 previously when I ran the patch upgrade to 2.3.5-p1 (again using composer to do the patch).

However, I noticed that elasticsearch had stopped working at some point so I can't be absolutely positive it was running successfully at the time I did the magento 2.4 upgrade.

Yes I do have the requires specified:

    "require": {
        "magento/composer-root-update-plugin": "~1.0",
        "magento/product-community-edition": "2.4.0",
        "php-webdriver/webdriver": "^1.8",
        "psr/container": "^1.0",
        "symfony/doctrine-bridge": "^5.1",
        "symfony/serializer": "^5.1"

I have elasticsearch running correctly now.

Also I entered the admin back-end and checked all the Elasticsearch settings. The only thing different from yours is the Elasticsearch server hostname is "localhost", since I am running it locally on the same server as Magento. I tested the elasticsearch connection and it reports "Successful! Test again?".

I don't know what I should do next to fix this install?

Thanks, Evelyn

hostep commented 4 years ago

@bluedarter2: this most likely happened because of this change in 2.4.0: https://github.com/magento/magento2/pull/25523/files

In the form.phtml file, they now call $viewModel->getUserName(), and $viewModel is something which is added through the contact_index_index.xml file. I'm not sure if the same thing can be accomplished with {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}, if you can somehow add that view_model argument as well in there, I don't think so, but I'm not sure.

So that's where you should start looking for a solution I think.

bluedarter2 commented 4 years ago

@hostep Thanks. I disabled that page, and now the Contact Us link goes to the 404 page not found. To be honest, I started stepping through the Magento store setup just after the first of the year (Jan 2020) then had to stop working on it. I've just picked it up again, and I can not for the life of me remember how to affect what happens when that link in the footer is clicked. I find Magento to be pretty difficult to understand/configure for a newbie. The shop I need to replace is a pre-Joomla (Mambo) php_shop (pre-VirtueMart).

[edit to add] OK, I "fixed" it by removing the "Contact Us" page that I had created.

mrtuvn commented 4 years ago

@hostep if you put {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}} in cms page (ex: home) the entire page will break just like @bluedarter2 describe It's cause viewModel not available In real use case maybe some 3rd-party theme will want reuse contact form template somewhere and call without define viewModel probably cause error

bluedarter2 commented 4 years ago

@hostep @mrtuvn In fact I was following the Magento 2 documentation when I started working with Magento 2, and the 2.4 docs still use this example! So the documentation should have been updated to reflect whatever is the correct thing to do: https://docs.magento.com/user-guide/stores/contact-us.html#method-2-without-sample-data

Item #3 there.

So perhaps someone can tell me how to correct the page?

mrtuvn commented 4 years ago

@bluedarter2 Technically if you need add some content in contact page you should extend contact template in theme. Add some additional code to call cms block inside this new template. Go to admin create new cms block and add content you want in backend. In that way you can avoid break code. No need to use cms page for contact like document

hostep commented 4 years ago

@bluedarter2: thanks for the link to the documentation! I've opened an issue with them to correct the documentation: https://github.com/magento/merchdocs/issues/648, not sure how long that's going to take

There are probably multiple ways to accomplish what you want to accomplish, but I'm afraid you'll have to search around a bit, the current documentation does not seem to be accurate anymore.

dobooth commented 4 years ago

Hi. Docs team here. What would be the proper fix for this? We can easily update the docs but would like to know the recommended way to do this. Please leave a comment in #648 and we will make the update. Thanks.

hostep commented 4 years ago

@dobooth is talking about https://github.com/magento/merchdocs/issues/648 btw

Unfortunately I currently don't have time to look into this in detail I'm afraid.

bluedarter2 commented 4 years ago

@hostep who did the code change? Surely they would know the correct way a user, such as myself, would need to react to their code change - and can give guidance to the docs people.

hostep commented 4 years ago

Hi @bluedarter2, maybe @rafaelstz knows the answer, but I think it won't be possible anymore to insert the contactform block into a cms page if it has required arguments, but I'm not 100% sure...

mrtuvn commented 4 years ago

if magento can introduce new way to inject viewModel in wysiwyg block/page possible resolve this problem In the meantime i think we can update doc to avoid confusing and make problem for user Previously -> create page (We don't need this way) New way -> create cms block and use default function widget to put block to specific area . By this way we don't even need touch in code ( no code break, editable or modifiable from backend )

rafaelstz commented 4 years ago

I checked and we don't have the XML customizations available in the CMS pages anymore, so we can't fix it via admin panel. The page that contains the contact form must implement the view_model via XML.

    <referenceContainer name="content">
            <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                <container name="form.additional.info" label="Form Additional Info"/>
                <arguments>
                    <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument>
                </arguments>
            </block>
    </referenceContainer>
bluedarter2 commented 4 years ago

@rafaelstz Thanks for the clarification. This is an upgrade breakage that should have been noted as such in the 2.4.0 release notes, "Incompatible Changes" https://devdocs.magento.com/guides/v2.4/release-notes/backward-incompatible-changes/index.html. Then the User Guide documentation for Contact Us should be updated to provide a new, correct, example of how to customize the Contact Us content if one doesn't have the sample data.

mrtuvn commented 4 years ago

@bluedarter2 the guide updated https://docs.magento.com/user-guide/stores/contact-us.html#method-2-without-sample-data

kevinjavitz commented 4 years ago

I checked and we don't have the XML customizations available in the CMS pages anymore, so we can't fix it via admin panel. The page that contains the contact form must implement the view_model via XML.

    <referenceContainer name="content">
            <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                <container name="form.additional.info" label="Form Additional Info"/>
                <arguments>
                    <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument>
                </arguments>
            </block>
    </referenceContainer>

Can you please explain more step by step if possible like what file to copy/paste the current contact page html from the cms manager to, and what file to put this xml code in?

heneral commented 3 years ago

have same issue image

using this block:

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}

please help

thanks

mrtuvn commented 3 years ago

You cannot call in CMS block. Try do it via widget or layout @heneral

heneral commented 3 years ago

You cannot call in CMS block. Try do it via widget or layout @heneral

please kindly teach me how to do it @mrtuvn because i am first time with magento 2..

very appreciate if you help me

thanks so much

mrtuvn commented 3 years ago

It's depend on your requirements and how complex on customise on contact you want The easy way is modify/update content in contact page Create new file contact_index_index.xml in your theme for customises Details you can read from this doc https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-extend.html or https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/xml-manage.html Take it's easy take your time for learn it. Magento is hard. You should learn basic things first

heneral commented 3 years ago

It's depend on your requirements and how complex on customise on contact you want The easy way is modify/update content in contact page Create new file contact_index_index.xml in your theme for customises Details you can read from this doc https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-extend.html or https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/xml-manage.html Take it's easy take your time for learn it. Magento is hard. You should learn basic things first

already created it but the problem i am using the root/vendor not the app/design, the result was error.. thanks for that @mrtuvn, yeah magento is so hard.. please kindly help me.. i think this is a bug on magento 2.4.0

heneral commented 3 years ago

@mrtuvn i try to create again, but still showing this

image

BB-000 commented 3 years ago

😫 The docs are still extremely vague... Like, could it be any more vague?! 😭

Still not clear from the docs what will and won't break it?

Devving Magento 2 is such a nightmare. And I'm not a noob either. The core code is a mess. Full of 🧐🤨😬😑. The frontend framework is "totally jacked". I could go on for minutes. But anyway...

Can't there be a really simple example like "to edit contact page content override the file in your theme like 'vendor/theme/Magento_Contact/contact_index_index.xml', and then call in your old 'contact-us-content' CMS block like this"? Or a simple example on how to import the contact form into a custom .phtml template? 😶

mrtuvn commented 3 years ago

I checked and we don't have the XML customizations available in the CMS pages anymore, so we can't fix it via admin panel. The page that contains the contact form must implement the view_model via XML.

    <referenceContainer name="content">
            <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                <container name="form.additional.info" label="Form Additional Info"/>
                <arguments>
                    <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument>
                </arguments>
            </block>
    </referenceContainer>

You can follow this

mrtuvn commented 3 years ago

If you call form via CMS page your template will missing view_model argument. That's reason your page will break. Some old theme still missing view_model and not update following Magento Implement. Another option is overwrite entire block contact by your own file (not recommended). You have to manually update your file with magento

hareshpatel commented 3 years ago

same error how can resolve help me

mrtuvn commented 3 years ago

Note your theme could be from app folder or vendor folder

First create file follow app/design/frontend/YourVendorBrand/yourThemeName/Magento_Contact/templates/form.phtml

Copy content from this file (or use your own file) https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Contact/view/frontend/templates/form.phtml If you want customise content file feel free customise in your file in theme . You can place cms block from this templates and modify it from backend (no need to edit code template for update)

Second (Optional but most important since 2.4.0 magento introduced viewModel but almost 3rd-party theme provider not follow standard could miss this thing) => Lead to issue Add layout app/design/frontend/YourVendorBrand/yourThemeName/Magento_Contact/layout/contact_index_index.xml content this file you can follow https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml You must have define argument viewModel infile layout xml if in your templates form.phtml created in previous step call to viewModel. If template you call viewModel ($block->getViewModel()) but somehow in layout you don't define viewModel => Error happen

Before 2.4.0 ✅ in your cms page from backend you can call direct contact form following {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}

After 2.4.x ❌

You can't do that anymore! Any guide from stackoverflow or magento.stackexchange is outdated. If error happen recheck steps above if you used custom theme or custom modules that affected to contact area! Conclusion No call contact form block from cms page. Instead do custom contact form template in theme

@hareshpatel @BB-000 @heneral @bluedarter2 @salesigniter

losttheplot commented 3 years ago

If it helps, this is how we created a bespoke Contact Us page for 2.4.2 that looks exactly like our previous page, which utilised the now-defunct direct block insertion method. The layout we previously used featured a full-width Google Map over two responsive columns - the left column contained the store's contact details, and the right column contained the Magento contact form.

First we created three new CMS blocks containing: (1) the Google Map, (2) the store's contact details and opening times with a title bar at the top of the column, and (3) the title bar for the contact form such that it matches the column alongside it.

The instructions for creating a base layer override can be found here > https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/layouts/layout-override.html but in short, one needs to create a new file in the theme directory thus: /Magento_Contact/layout/override/base/contact_index_index.xml

How you layout and style your page is up to you, but this is how ours now looks (I don't profess to be an expert with the Magento layout files so feel free to correct any superfluous or non-best-practice syntax).

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact Us</title>
    </head>
    <body>

        <!-- add Google map (block ID: google_map) inside a new div -->
        <referenceContainer name="content">
            <container name="contact.map" as="contactMap" label="Contact Map" htmlTag="div" before="-" htmlClass="contact-map">
                <block class="Magento\Cms\Block\Block" name="google-map">
                    <arguments>
                        <argument name="block_id" xsi:type="string">google_map</argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>

        <!-- add two responsive columns inside existing main column under map -->
        <referenceContainer name="content">
            <container name="contact.details.row" as="contactDetailsRow" htmlTag="div" after="-" htmlClass="row">
                <container name="contact.details.info" as="contactDetailsInfo" htmlTag="div" after="-" htmlClass="col-md-6 contact-info"/>
                <container name="contact.details.form" as="contactDetailsForm" htmlTag="div" after="-" htmlClass="col-md-6 contact-form"/>
            </container>
        </referenceContainer>

        <!-- add store details (with title) in left-hand column -->
        <referenceContainer name="contact.details.info">
            <container name="contact.info" as="contactInfo" label="Contact Info" htmlTag="div" after="-" htmlClass="contact-us-info">
                <block class="Magento\Cms\Block\Block" name="contact-us-info">
                    <arguments>
                        <argument name="block_id" xsi:type="string">contact_us_info</argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>

        <!-- add form container and title in right-hand column -->
        <referenceContainer name="contact.details.form">
            <container name="contact.form" as="contactForm" label="Contact Form" htmlTag="div" after="-" htmlClass="contact-us-form">
                <block class="Magento\Cms\Block\Block" name="contact-form-title">
                    <arguments>
                        <argument name="block_id" xsi:type="string">contact_form_title</argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>

        <!-- add Magento contact form as per original contact_index_index.xml file -->
        <referenceContainer name="contact.form">
            <block class="Magento\Contact\Block\ContactForm" name="contactForm" after="-" template="Magento_Contact::form.phtml">
                <container name="form.additional.info" label="Form Additional Info"/>
                <arguments>
                    <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument>
                </arguments>
            </block>
        </referenceContainer>

    </body>
</page>
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

m2-assistant[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 3 years ago

Hi @bluedarter2 ,

We have tried to reproduce this issue as per the mentioned steps, but we are unable to do the same. We have followed below URL to upgrade the Magento from 2.3.5-p1 to 2.4.0:

https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html

Before Upgrade - 2.3.5-p1 Admin dashboard with version information: VersionCheckBFUpgrade

Contact us page before upgrade: ContactUsPageBFUpgrade

After Upgrade - 2.4.0 Admin dashboard with version information: VersionCheckAFUpgrade

Contact us page after upgrade: ContactUsPageAFUpgrade

Please check once at your end and let us know if you still facing any issue related with that.

engcom-Hotel commented 3 years ago

Hello @bluedarter2,

We are unable to hear from you since past 14 days. So we are closing this issue for now. If you still facing this issue either you can reopen this ticket or create new ticket.

Thanks

ioweb-gr commented 2 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 2 years ago

Hi @ioweb-gr. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @ioweb-gr, here is your Magento Instance: https://ff3f25818cb462cb912ab36996cc0082.instances.magento-community.engineering Admin access: https://ff3f25818cb462cb912ab36996cc0082.instances.magento-community.engineering/admin_adc5 Login: 22d07861 Password: 5fcba63efc8e

ioweb-gr commented 2 years ago

Hi @engcom-Hotel , why was this issue closed as cannot reproduce? it's perfectly fine reproducible in latest develop instance

Step1. Create a CMS page and add a contact form block to it

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}} image

Step2. Open the page in frontend and see the error

image

The issue is that the addition of a viewModel inside the contact form block, leads to making the contact form block being unusable in other cms pages or blocks.

Moreover this cannot be fixed using a layout update for the specific page

e.g.

adding an xml layout instruction like this on the file app/design/frontend/Vendor/theme/Magento_Cms/layout/cms_page_view_id_[your-identifier].xml


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="contactForm">
        <arguments>
            <argument name="view_model" xsi:type="object">Magento\Contact\ViewModel\UserDataProvider</argument>
        </arguments>
    </referenceBlock>
</page>

Doesn't make a difference. I think this issue should be reopened as it's a valid bug. There's also no documentation on how to add the block and viewmodel on the curly braces syntax and it's not possible to do it via a customized layout instruction on the specific page.

hostep commented 2 years ago

@ioweb-gr: please read the entire thread, it was decided that this is no longer possible in Magento 2.4.0 and higher. The documentation has been updated to reflect that. And please ignore the engcom team's responses, they usually don't know what they are talking about, they only care about closing as many issues as they possibly can and somehow get away with it.

Try following some tutorials of how custom frontend code works in Magento and you'll eventually get there, I'm sure that doing this will help you further in other features that you might want to add in the future.

ioweb-gr commented 2 years ago

I've implemented a workaround by extending the contact form block and using the extended one but my point is that this is a bug anyhow and should be addressed.

Currently it's the contact form but soon it may be others as well. We should have a way to reuse blocks in cms pages