How to pass data from Controller to View Template files in Magento 2?

You can pass data from the Controller action to the Template files in Magento via Block Class.

You can’t directly pass controller data to view the template files but using the Block class you can achieve it successfully.

By use of the Magento interface, Magento\Framework\App\Request\DataPersistorInterface We are able to store data by key with the set(), get() method. Continue reading “How to pass data from Controller to View Template files in Magento 2?”

How to add Cms Page Custom Layout Update file in Magento 2.3.4?

From Magento 2.3.4, For the security enhancements, default custom layout update Textarea removed from the CMS page admin section.

If you want to add XML code snippet for the CMS Page, You must have to create a CMS Page layout handle for the page.

If you want to add Custom layout update code for the About Us page, You need to create a unique XML handle for the CMS page. Continue reading “How to add Cms Page Custom Layout Update file in Magento 2.3.4?”

How to add Category Custom Layout Update XML file in Magento 2.3.4?

From Magento 2.3.4, Custom Layout Update Textarea removed from the admin panel category edit page, product edit page and cms edit page to remove the opportunity of Remote Code Execution (RCE). Replace Textarea with a selector.

Earlier you can add directly XML code snippet for the specific entity from the backend but from Magento 2.3.4 new feature was added. You need to create an XML file in your theme or module level and assign an XML file to the Custom Layout Update selector. Continue reading “How to add Category Custom Layout Update XML file in Magento 2.3.4?”