/** * Return header comment part of html for fieldset * * @param \Magento\Framework\Data\Form\Element\AbstractElement $element * @return string */ protected function _getHeaderCommentHtml($element) { $groupConfig = $element->getGroup(); if (empty($groupConfig['help_url']) || !$element->getComment()) { return parent::_getHeaderCommentHtml($element); } $html = '<div class="comment">' . $element->getComment() . ' <a target="_blank" href="' . $groupConfig['help_url'] . '">' . __('Help') . '</a></div>'; return $html; }
public function testRenderWithStoredElements() { $this->_helperMock->expects($this->any())->method('getScript')->will($this->returnArgument(0)); $fieldMock = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Text', ['getId', 'getTooltip', 'toHtml'], [], '', false, false, true); $fieldMock->expects($this->any())->method('getId')->will($this->returnValue('test_field_id')); $fieldMock->expects($this->any())->method('getTooltip')->will($this->returnValue('test_field_tootip')); $fieldMock->expects($this->any())->method('toHtml')->will($this->returnValue('test_field_toHTML')); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $factory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false); $factoryColl = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', [], [], '', false); $formMock = $this->getMock('Magento\\Framework\\Data\\Form\\AbstractForm', [], [$factory, $factoryColl]); $collection = $helper->getObject('Magento\\Framework\\Data\\Form\\Element\\Collection', ['container' => $formMock]); $collection->add($fieldMock); $this->_elementMock->expects($this->any())->method('getElements')->will($this->returnValue($collection)); $actual = $this->_object->render($this->_elementMock); $this->assertContains('test_field_toHTML', $actual); $expected = '<div id="row_test_field_id_comment" class="system-tooltip-box"' . ' style="display:none;">test_field_tootip</div>'; $this->assertContains($expected, $actual); }
/** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Framework\View\Helper\Js $jsHelper * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollection * @param array $data */ public function __construct(\Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\View\Helper\Js $jsHelper, \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollection, array $data = array()) { $this->_orderStatusCollection = $orderStatusCollection; parent::__construct($context, $authSession, $jsHelper, $data); }
/** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Framework\View\Helper\Js $jsHelper * @param array $data */ public function __construct(\Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\View\Helper\Js $jsHelper, array $data = array()) { parent::__construct($context, $authSession, $jsHelper, $data); }
/** * @param \Magento\Backend\Block\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Framework\View\Helper\Js $jsHelper * @param \Magento\Framework\Module\ModuleListInterface $moduleList * @param array $data */ public function __construct(\Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\View\Helper\Js $jsHelper, \Magento\Framework\Module\ModuleListInterface $moduleList, array $data = array()) { parent::__construct($context, $authSession, $jsHelper, $data); $this->_moduleList = $moduleList; }
/** * Add custom css class * * @param \Magento\Framework\Data\Form\Element\AbstractElement $element * @return string */ protected function _getFrontendClass($element) { $enabledString = $this->_isPaymentEnabled($element) ? ' enabled' : ''; return parent::_getFrontendClass($element) . ' with-button' . $enabledString; }