Question

I want the users who download and install my extension from the marketplace to go through a registration/login flow. Since the normal system.xml file supports only static pages and doing the entire thing using FE models is too complicated, I'm wondering if I can instead show everything in an iframe?

Showing everything in an iframe gives me lot of advantages like -

  • Flexibility over design. Magento buttons/elements are ugly.
  • Being able to use the same iframe my other eCommerce offerings
  • Much much less engineering time since our team is much more comfortable with JavaScript/CSS than PHP/XML etc

So my question is how to implement the iframe and are there any disadvantages that I'm missing?

I see its possible for Magento 1

Was it helpful?

Solution

You need to create custom type in form

$fieldset->addType('map', '\Vendor\Module\Block\Adminhtml\Youblock\Renderer\Map');

$fieldset->addField(
    'file',
    'map',
    [
        'name'  => 'map',
        'label' => __('Map'),
        'title' => __('Map'),

    ]
);

app/code/Vendor/Module/Block/Adminhtml/Yourblock/Renderer/Map.php

<?php

namespace Vendor\Module\Block\Adminhtml\Yourblock\Renderer;

use Magento\Framework\DataObject;

class Map extends \Magento\Framework\Data\Form\Element\AbstractElement
{
    public function getElementHtml()
    {
        $iframe = "<iframe>Your iframe Here</iframe>";
        return $iframe;
    }

}

OTHER TIPS

As with frontend, you can implement a custom backend theme. As part of your custom theme, you can define and include a .phtml template which can include arbitrary HTML, CSS, Javascript, and PHP -- i.e. you can include an iframe via a template.

If you are not yet familiar with adding a template to your theme, I would get started with the DevDocs Frontend Developer Guide: Templates overview.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top