Skip to content

Commit 568792a

Browse files
committed
Changed config field
1 parent 59399b9 commit 568792a

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

Block/Adminhtml/System/Config/Form/ProductKeyField.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@
1616
*/
1717
class ProductKeyField extends Field
1818
{
19-
/**
20-
* @var \Magefan\Community\Model\Section
21-
*/
22-
protected $section;
23-
24-
/**
25-
* ProductKeyField constructor.
26-
* @param Context $context
27-
* @param array $data
28-
*/
29-
public function __construct(Context $context, array $data = [])
30-
{
31-
parent::__construct($context, $data);
32-
$this->section = ObjectManager::getInstance()->get(Section::class);
33-
}
34-
3519
/**
3620
* Retrieve HTML markup for given form element
3721
*
@@ -40,14 +24,16 @@ public function __construct(Context $context, array $data = [])
4024
*/
4125
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
4226
{
43-
if ($this->section->getModule()) {
27+
$fieldConfig = $element->getFieldConfig();
28+
$path = explode('/', $fieldConfig['path']);
29+
$path = $path[0];
30+
31+
$section = ObjectManager::getInstance()->create(Section::class, ['name' => $path]);
32+
if ($section->getModule()) {
4433
if (!$element->getComment()) {
4534
$url = strrev('/stcudorp/remotsuc/elbadaolnwod/moc.nafegam//:sptth');
4635
$element->setComment('You can find product key in your <a href="' . $url . '" target="_blank">Magefan account</a>.');
4736
}
48-
if (!$element->getLabel()) {
49-
$element->setLabel('Product Key');
50-
}
5137
return parent::render($element);
5238
} else {
5339
return '';

0 commit comments

Comments
 (0)