I want to add phtml
file in Grid\Edit which is contain image or other html part
Following Form.php
file
<?php
namespace Vandor\Namespace\Block\Adminhtml\Grid\Edit;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Registry;
use Magento\Framework\Data\FormFactory;
use Magento\Cms\Model\Wysiwyg\Config;
class Form extends Generic
{
protected $systemStore;
protected $wysiwygConfig;
public function __construct(
Context $context,
Registry $registry,
FormFactory $formFactory,
Config $wysiwygConfig,
array $data = []
)
{
$this->wysiwygConfig = $wysiwygConfig;
parent::__construct($context, $registry, $formFactory, $data);
}
protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('row_data');
$form = $this->_formFactory->create(
['data' => [
'id' => 'edit_form',
'enctype' => 'multipart/form-data',
'action' => $this->getData('action'),
'method' => 'post'
]
]
);
$form->setHtmlIdPrefix('namegrid');
$fieldset = $form->addFieldset(
'base_fieldset',
['legend' => __('Edit Detail'), 'class' => 'fieldset-wide']
);
$fieldset->addField('id', 'hidden', ['name' => 'id']);
$fieldset->addField(
'title',
'text',
[
'name' => 'title',
'label' => __('Title'),
'id' => 'title',
'title' => __('Title'),
'class' => 'required-entry',
'required' => true,
]
);
$wysiwygConfig = $this->wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);
$fieldset->addField(
'content',
'editor',
[
'name' => 'content',
'label' => __('Content'),
'style' => 'height:36em;',
'required' => true,
'config' => $wysiwygConfig
]
);
$form->setValues($model->getData());
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
public function getFormHtml()
{
$html = $this->setTemplate('Vandor_Namespace::grid/image.phtml')->toHtml();
$html .= parent::getFormHtml();
return $html;
}
}
Its show top of the main container.
Which is better way to add phtml
in between form container