File tree Expand file tree Collapse file tree 1 file changed +6
-20
lines changed
Block/Adminhtml/System/Config/Form Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Original file line number Diff line number Diff line change 1616 */
1717class 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 '' ;
You can’t perform that action at this time.
0 commit comments