Hello Magento Friends,

I am back with yet another useful Magento solution. Today it’s about Adding a Custom Button in the Backend CMS Page Section of your Magento 2 admin.

As a Magento 2 store owner or developer, you might encounter situations where you need to enhance the backend CMS Page section with custom functionalities. One common requirement is adding a custom button to perform specific actions related to CMS pages.

This capability empowers you to extend the functionality of your Magento store and streamline content management processes. With the custom button in place, you can perform specific actions related to CMS pages directly from the backend, providing a more efficient and user-friendly experience for content managers and administrators.

Let’s look at the step-by-step process to Add a Custom Button in Magento 2 Backend CMS Page Section.

Steps to Add Custom Button in Magento 2 Backend CMS Page Section:

Step 1: First, we need to create a cms_page_form.xml file inside the extension at the following path.

app\code\Vendor\Extension\view\adminhtml\ui_component

Then add the code as below.

Step 2: After that, we need to create a Cmsbutton.php file inside the extension at the following path.

app\code\Vendor\Extension\Block\Adminhtml\Cms\Edit

And add the following code snippet.

Step 3: After that, we need to create a button.phtml file inside the extension at the following path.

app\code\Vendor\Extension\view\adminhtml\templates\cms

Finally, append the below piece of code.

Output

Now, you should see the custom button in the backend CMS Page edit section, and when clicked, it will trigger the action defined in the controller.

custom button in cms page

Conclusion:

By following the steps outlined in this article, you can easily add a custom button to the Magento 2 backend CMS Page section. Other areas to add a custom button on the backend admin

Share the article with your friends and stay in touch with us.

Happy Coding!

Click to rate this post!
[Total: 1 Average: 1]