I have Custom Edit page in Adminpanel as below:
Above Reply textbox, I want to show other records from my custom table in custom HTML format. but not sure how can i use custom html format there!!
My edit page code:
<?php
namespace Vendor\Module\Block\Adminhtml\Items\Edit\Tab;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
class Reply extends Generic implements TabInterface
{
protected $_wysiwygConfig;
protected $layoutFactory;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig,
\Magento\Framework\View\LayoutFactory $layoutFactory,
array $data = []
)
{
$this->_wysiwygConfig = $wysiwygConfig;
$this->layoutFactory = $layoutFactory;
parent::__construct($context, $registry, $formFactory, $data);
}
/**
* {@inheritdoc}
*/
public function getTabLabel()
{
return __('Replies');
}
/**
* {@inheritdoc}
*/
public function getTabTitle()
{
return __('Replies');
}
/**
* {@inheritdoc}
*/
public function canShowTab()
{
return true;
}
/**
* {@inheritdoc}
*/
public function isHidden()
{
return false;
}
/**
* Prepare form before rendering HTML
*
* @return $this
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('current_custom_items');
$updates = $this->_coreRegistry->registry('current_custom_updates');
/**** In $updates i get Collection of records which i want to show above Reply textbox ***/
/** @var \Magento\Framework\Data\Form $form */
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('item_');
$fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Replies ')]);
if ($model->getId()) {
$fieldset->addField('id', 'hidden', ['name' => 'id']);
}
$fieldset->addField(
'Reply',
'textarea',
[
'name' => 'comment',
'label' => __('Reply'),
'title' => __('Reply'),
'required' => true
]
);
$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
}