Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FrontTabPlugin.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  private $weightSource;
22 
26  public function __construct(Weight $weightSource)
27  {
28  $this->weightSource = $weightSource;
29  }
30 
38  public function beforeSetForm(ProductAttributeFrontTabBlock $subject, Form $form)
39  {
41  $fieldset = $form->getElement('front_fieldset');
42  $fieldset->addField(
43  'search_weight',
44  'select',
45  [
46  'name' => 'search_weight',
47  'label' => __('Search Weight'),
48  'values' => $this->weightSource->getOptions()
49  ],
50  'is_searchable'
51  );
52  $subject->getChildBlock('form_after')
53  ->addFieldMap('search_weight', 'search_weight')
54  ->addFieldDependence('search_weight', 'searchable', '1');
55  }
56 }
getElement($elementId)
Definition: Form.php:201
__()
Definition: __.php:13