Skip to content

In a CMS Page, can I call a custom phtml with custom attributes? Example inside. #5329

@grasdaggel

Description

@grasdaggel

Hi there,

the standard way to call a PHTML file inside a Page CMS is this:

{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml"}}

What I want to do is for example pass several arguments to that block. Example:

{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::html/test.phtml" data-title="New Products" data-productamount="5"}}

What I generally want to achieve is to make PHTML files more dynamically. Is this possible? On Stackexchange I've found nothing for this matter, so maybe this could be a feature for future Magento2 releases.

What do you think about that? Is something like this already possible?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions