Example #1
0
 /**
  * Populate form fieldset with group data
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return void
  */
 public function populateFieldset(\Magento\Framework\Data\Form\Element\Fieldset $fieldset)
 {
     $originalData = [];
     foreach ($this->_data as $key => $value) {
         if (!is_array($value)) {
             $originalData[$key] = $value;
         }
     }
     $fieldset->setOriginalData($originalData);
 }
Example #2
0
 /**
  * 2016-07-01
  * @override
  * @see \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderCommentHtml()
  * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L166-L175
  * @used-by \Magento\Config\Block\System\Config\Form\Fieldset::_getHeaderHtml()
  * https://github.com/magento/magento2/blob/2.1.0/app/code/Magento/Config/Block/System/Config/Form/Fieldset.php#L121
  * @param AE|F $element
  * @return string
  */
 protected function _getHeaderCommentHtml($element)
 {
     /** @var string|null $infoClass */
     $infoClass = dfa_deep($element->getData(), 'group/dfExtension');
     /** @var string $result */
     if (!$infoClass) {
         $result = parent::_getHeaderCommentHtml($element);
     } else {
         /** @var \Df\Config\Ext $extensionInfo */
         $info = df_o($infoClass);
         $result = df_tag('div', 'comment', df_tag_ab(__('Have a question?'), $info->url()));
     }
     return $result;
 }
 /**
  * Constructor helper
  *
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->setLegend($this->getLabel());
     $this->_addElementTypes();
     $this->_addFields();
     $this->addClass('element-' . static::CONTROL_TYPE);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function getHtml()
 {
     $checked = [];
     if ($this->getIndex()->hasProperty('include_category')) {
         $checked[] = 'include_category';
     }
     if ($this->getIndex()->hasProperty('include_bundled')) {
         $checked[] = 'include_bundled';
     }
     if ($this->getIndex()->hasProperty('include_id')) {
         $checked[] = 'include_id';
     }
     if ($this->getIndex()->hasProperty('include_custom_options')) {
         $checked[] = 'include_custom_options';
     }
     if ($this->getIndex()->hasProperty('out_of_stock_to_end')) {
         $checked[] = 'out_of_stock_to_end';
     }
     if ($this->getIndex()->hasProperty('only_active_categories')) {
         $checked[] = 'only_active_categories';
     }
     $this->addField('properties', 'checkboxes', ['name' => 'properties[]', 'label' => __('Options'), 'values' => ['include_category' => __('Search by parent categories names'), 'include_bundled' => __('Search by child products (for bundle, configurable products)'), 'include_id' => __('Search by product id'), 'include_custom_options' => __('Search by custom options'), 'out_of_stock_to_end' => __('Push "out of stock" products to the end'), 'only_active_categories' => __('Search only by active categories')], 'checked' => $checked]);
     return parent::getHtml();
 }
Example #5
0
 /**
  * {@inheritDoc}
  */
 public function addAvaTaxCodeField(\Magento\Framework\Data\Form\Element\Fieldset $fieldset)
 {
     $fieldset->addField('avatax_code', 'select', ['name' => 'avatax_code', 'label' => __('AvaTax Customer Usage Type'), 'note' => __('Optional. The AvaTax <strong>Customer Usage Type</strong> (or <strong>Entity Use Code</strong>). Refer to the <a href="%1" target="_blank">AvaTax documentation</a> for more information.', 'https://help.avalara.com/kb/001/What_are_the_exemption_reasons_for_each_Entity_Use_Code_used_for_Avalara_AvaTax%3F'), 'values' => $this->avaTaxCustomerUsageType->toOptionArray()]);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function getHtml()
 {
     $this->addField('url_template', 'text', ['name' => 'properties[url_template]', 'label' => __('Url Template'), 'required' => true, 'value' => $this->getIndex()->getProperty('url_template')]);
     return parent::getHtml();
 }
Example #7
0
 /**
  * 2015-11-17
  * @override
  * @see \Magento\Framework\Data\Form\AbstractForm::_construct()
  * @used-by \Magento\Framework\Data\Form\AbstractForm::__construct()
  * @return void
  */
 protected function _construct()
 {
     $this->addClass('df-fieldset');
     parent::_construct();
 }
Example #8
0
 /**
  * Constructor helper
  *
  * @return void
  */
 public function _construct()
 {
     parent::_construct();
     $this->_addElementTypes();
     $this->addClass(self::CONTROL_TYPE);
 }
Example #9
0
 /**
  * Get field html
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @param string $id
  * @param string $status
  * @return string
  */
 protected function _getFieldHtml($fieldset, $id, $status)
 {
     $configData = $this->getConfigData();
     $path = 'sales/order_statuses/status_' . $id;
     //TODO: move as property of form
     $data = isset($configData[$path]) ? $configData[$path] : array();
     $e = $this->_getDummyElement();
     $field = $fieldset->addField($id, 'text', array('name' => 'groups[order_statuses][fields][status_' . $id . '][value]', 'label' => $status, 'value' => isset($data['value']) ? $data['value'] : $status, 'default_value' => isset($data['default_value']) ? $data['default_value'] : '', 'old_value' => isset($data['old_value']) ? $data['old_value'] : '', 'inherit' => isset($data['inherit']) ? $data['inherit'] : '', 'can_use_default_value' => $this->getForm()->canUseDefaultValue($e), 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e)))->setRenderer($this->_getFieldRenderer());
     return $field->toHtml();
 }
Example #10
0
    public function appendKeywordsFields(\Magento\Framework\Data\Form\Element\Fieldset $fieldSet, $fieldCount, $name)
    {
        $helper = $this->getHelper('Data');
        for ($i = 0; $i < $fieldCount; $i++) {
            $button = $this->getMultiElementButton($name, $i);
            $value = '';
            if (!empty($this->formData[$name][$i])) {
                $value = $helper->escapeHtml($this->formData[$name][$i]);
            }
            $fieldSet->addField($name . '_' . $i, 'text', ['name' => 'definition[' . $name . '][' . $i . ']', 'label' => $this->__('Target Audience Value #%s%', $i + 1), 'title' => $this->__('Target Audience Value #%s%', $i + 1), 'value' => $value, 'onkeyup' => 'AmazonTemplateDescriptionDefinitionObj.multi_element_keyup(\'' . $name . '\',this)', 'required' => true, 'css_class' => $name . '_tr no-margin-bottom', 'field_extra_attributes' => 'style="display: none;"', 'after_element_html' => $button->toHtml(), 'tooltip' => $this->__('Max. 50 characters.')]);
        }
        $fieldSet->addField($name . '_actions', self::CUSTOM_CONTAINER, ['text' => <<<HTML
                <a id="show_{$name}_action"
                   href="javascript: void(0);"
                   onclick="AmazonTemplateDescriptionDefinitionObj.showElement('{$name}');">
                   {$this->__('Add New')}
                </a>
                        /
                <a id="hide_{$name}_action"
                   href="javascript: void(0);"
                   onclick="AmazonTemplateDescriptionDefinitionObj.hideElement('{$name}');">
                   {$this->__('Remove')}
                </a>
HTML
, 'field_extra_attributes' => 'id="' . $name . '_actions_tr" style="display: none;"']);
    }
Example #11
0
 /**
  * Prepare group id field in the fieldset
  *
  * @param \Magento\Framework\Data\Form $form
  * @param \Magento\Store\Model\Store $storeModel
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return \Magento\Framework\Data\Form\Element\Fieldset
  */
 private function prepareGroupIdField(\Magento\Framework\Data\Form $form, \Magento\Store\Model\Store $storeModel, \Magento\Framework\Data\Form\Element\Fieldset $fieldset)
 {
     if ($storeModel->getId() && $storeModel->getGroup()->getDefaultStoreId() == $storeModel->getId()) {
         if ($storeModel->getGroup() && $storeModel->getGroup()->getStoresCount() > 1) {
             $form->getElement('store_group_id')->setDisabled(true);
             $fieldset->addField('store_hidden_group_id', 'hidden', ['name' => 'store[group_id]', 'no_span' => true, 'value' => $storeModel->getGroupId()]);
         } else {
             $fieldset->addField('store_original_group_id', 'hidden', ['name' => 'store[original_group_id]', 'no_span' => true, 'value' => $storeModel->getGroupId()]);
         }
     }
     return $fieldset;
 }
Example #12
0
 /**
  * {@inheritdoc}
  */
 public function getHtml()
 {
     $this->addField('db_connection_name', 'text', ['name' => 'properties[db_connection_name]', 'label' => __('Database Connection Name'), 'required' => true, 'value' => $this->getIndex()->getProperty('db_connection_name')]);
     $this->addField('db_table_prefix', 'text', ['name' => 'properties[db_table_prefix]', 'label' => __('Table Prefix'), 'required' => false, 'value' => $this->getIndex()->getProperty('db_table_prefix')]);
     return parent::getHtml();
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 public function getHtml()
 {
     $this->addField('ignored_pages', 'multiselect', ['name' => 'properties[ignored_pages]', 'label' => __('Ignored Pages'), 'required' => false, 'values' => $this->configSourcePage->toOptionArray(), 'value' => $this->getIndex()->getProperty('ignored_pages')]);
     return parent::getHtml();
 }
Example #14
0
 /**
  * Prepare store element
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return void
  */
 protected function _prepareStoreElement($fieldset)
 {
     // get store switcher or a hidden field with it's id
     if ($this->_storeManager->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => $this->_storeManager->getStore(true)->getId()), 'id_path');
     } else {
         /** @var $renderer \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element */
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $storeElement = $fieldset->addField('store_id', 'select', array('label' => __('Store'), 'title' => __('Store'), 'name' => 'store_id', 'required' => true, 'values' => $this->_getRestrictedStoresList(), 'disabled' => $this->_getModel()->getIsSystem(), 'value' => $this->_formValues['store_id']), 'id_path');
         $storeElement->setRenderer($renderer);
     }
 }
Example #15
0
 /**
  * Append display related fields.
  *
  * @param Fieldset $fieldset Target fieldset
  *
  * @return FrontPlugin
  */
 private function addDisplayFields(Fieldset $fieldset)
 {
     $fieldset->addField('display_pattern', 'text', ['name' => 'display_pattern', 'label' => __('Display pattern'), 'note' => __('A pattern like %s UNIT where %s is the value. Eg : $%s => $20 or %s € => 20 €')]);
     $fieldset->addField('display_precision', 'text', ['name' => 'display_precision', 'label' => __('Display Precision'), 'class' => 'validate-digits', 'value' => '0', 'note' => __('The number of digits to use for precision when displaying.')], 'display_pattern');
     return $this;
 }
Example #16
0
 /**
  * Add reset button to fieldset
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @param array $defaultValues
  * @param string $name
  * @return $this
  */
 protected function _addResetButton($fieldset, $defaultValues, $name)
 {
     $fieldset->addField($name . '_reset', 'button_button', ['name' => $name . '_reset', 'title' => __('Reset to Original'), 'value' => __('Reset to Original'), 'class' => 'action-reset', 'data-mage-init' => $this->escapeHtml(json_encode(['button' => ['event' => 'restoreDefaultData', 'target' => 'body', 'eventData' => $defaultValues]]))]);
     return $this;
 }
Example #17
0
 /**
  * @param \Magento\Framework\Data\Form\Element\Factory $factoryElement
  * @param \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Tax\Block\Adminhtml\Rate\Title $title
  * @param array $data
  */
 public function __construct(\Magento\Framework\Data\Form\Element\Factory $factoryElement, \Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Framework\Escaper $escaper, \Magento\Tax\Block\Adminhtml\Rate\Title $title, $data = [])
 {
     $this->_title = $title;
     parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
 }
Example #18
0
 /**
  * @dataProvider getSubFieldsetDataProvider
  * @param array $fields
  * @param int $expect
  */
 public function testGetSubFieldset($fields, $expect)
 {
     $this->_fillFieldset($fields);
     $this->assertCount($expect, $this->_fieldset->getAdvancedChildren());
 }
Example #19
0
 /**
  * Add media role attributes to fieldset
  *
  * @param Fieldset $fieldset
  * @return $this
  */
 protected function addMediaRoleAttributes(Fieldset $fieldset)
 {
     $fieldset->addField('roleLabel', 'note', ['text' => __('Role')]);
     $mediaRoles = $this->getProduct()->getMediaAttributes();
     ksort($mediaRoles);
     foreach ($mediaRoles as $mediaRole) {
         $fieldset->addField('video_' . $mediaRole->getAttributeCode(), 'checkbox', ['class' => 'video_image_role', 'label' => __($mediaRole->getFrontendLabel()), 'title' => __($mediaRole->getFrontendLabel()), 'data-role' => 'role-type-selector', 'value' => $mediaRole->getAttributeCode()]);
     }
     return $this;
 }
Example #20
0
 /**
  * Prepare form fieldset
  * All fields are visible
  *
  * @param Fieldset $fieldset
  * @return $this
  */
 protected function _prepareVisibleFields(Fieldset $fieldset)
 {
     $fieldset->addField('sender', 'text', ['name' => $this->_getFieldName('sender'), 'label' => __('From'), 'required' => $this->getMessage()->getMessage() ? true : false]);
     $fieldset->addField('recipient', 'text', ['name' => $this->_getFieldName('recipient'), 'label' => __('To'), 'required' => $this->getMessage()->getMessage() ? true : false]);
     $fieldset->addField('message', 'textarea', ['name' => $this->_getFieldName('message'), 'label' => __('Message'), 'rows' => '5', 'cols' => '20']);
     return $this;
 }
Example #21
0
 /**
  * {@inheritDoc}
  */
 public function addAvaTaxCodeField(\Magento\Framework\Data\Form\Element\Fieldset $fieldset)
 {
     $fieldset->addField('avatax_code', 'text', ['name' => 'avatax_code', 'label' => __('AvaTax Tax Code'), 'note' => __('Optional. AvaTax system Tax Code or custom Tax Code. See <a href="%1" target="_blank">AvaTax documentation</a> for more details.', \ClassyLlama\AvaTax\Helper\Config::AVATAX_DOCUMENTATION_TAX_CODE_LINK), 'class' => 'validate-length maximum-length-25']);
 }
Example #22
0
 /**
  * Initialize form element
  *
  * @param \Magento\Backend\Model\Config\Structure\Element\Field $field
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @param string $path
  * @param string $fieldPrefix
  * @param string $labelPrefix
  * @return void
  */
 protected function _initElement(\Magento\Backend\Model\Config\Structure\Element\Field $field, \Magento\Framework\Data\Form\Element\Fieldset $fieldset, $path, $fieldPrefix = '', $labelPrefix = '')
 {
     $inherit = true;
     $data = null;
     if (array_key_exists($path, $this->_configData)) {
         $data = $this->_configData[$path];
         $inherit = false;
     } elseif ($field->getConfigPath() !== null) {
         $data = $this->getConfigValue($field->getConfigPath());
     } else {
         $data = $this->getConfigValue($path);
     }
     $fieldRendererClass = $field->getFrontendModel();
     if ($fieldRendererClass) {
         $fieldRenderer = $this->_layout->getBlockSingleton($fieldRendererClass);
     } else {
         $fieldRenderer = $this->_fieldRenderer;
     }
     $fieldRenderer->setForm($this);
     $fieldRenderer->setConfigData($this->_configData);
     $elementName = $this->_generateElementName($field->getPath(), $fieldPrefix);
     $elementId = $this->_generateElementId($field->getPath($fieldPrefix));
     if ($field->hasBackendModel()) {
         $backendModel = $field->getBackendModel();
         $backendModel->setPath($path)->setValue($data)->setWebsite($this->getWebsiteCode())->setStore($this->getStoreCode())->afterLoad();
         $data = $backendModel->getValue();
     }
     $dependencies = $field->getDependencies($fieldPrefix, $this->getStoreCode());
     $this->_populateDependenciesBlock($dependencies, $elementId, $elementName);
     $sharedClass = $this->_getSharedCssClass($field);
     $requiresClass = $this->_getRequiresCssClass($field, $fieldPrefix);
     $formField = $fieldset->addField($elementId, $field->getType(), ['name' => $elementName, 'label' => $field->getLabel($labelPrefix), 'comment' => $field->getComment($data), 'tooltip' => $field->getTooltip(), 'hint' => $field->getHint(), 'value' => $data, 'inherit' => $inherit, 'class' => $field->getFrontendClass() . $sharedClass . $requiresClass, 'field_config' => $field->getData(), 'scope' => $this->getScope(), 'scope_id' => $this->getScopeId(), 'scope_label' => $this->getScopeLabel($field), 'can_use_default_value' => $this->canUseDefaultValue($field->showInDefault()), 'can_use_website_value' => $this->canUseWebsiteValue($field->showInWebsite())]);
     $field->populateInput($formField);
     if ($field->hasValidation()) {
         $formField->addClass($field->getValidation());
     }
     if ($field->getType() == 'multiselect') {
         $formField->setCanBeEmpty($field->canBeEmpty());
     }
     if ($field->hasOptions()) {
         $formField->setValues($field->getOptions());
     }
     $formField->setRenderer($fieldRenderer);
 }
Example #23
0
 /**
  * Edit/View Existing Customer form fields
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return string[] Values to set on the form
  */
 protected function _addEditCustomerFormFields($fieldset)
 {
     $fieldset->getForm()->getElement('created_in')->setDisabled('disabled');
     $fieldset->getForm()->getElement('website_id')->setDisabled('disabled');
     $customerData = $this->_getCustomerDataObject();
     if ($customerData->getId() && !$this->_customerAccountService->canModify($customerData->getId())) {
         return array();
     }
     // Prepare customer confirmation control (only for existing customers)
     $confirmationStatus = $this->_customerAccountService->getConfirmationStatus($customerData->getId());
     $confirmationKey = $customerData->getConfirmation();
     if ($confirmationStatus != CustomerAccountServiceInterface::ACCOUNT_CONFIRMED) {
         $confirmationAttr = $this->_customerMetadataService->getCustomerAttributeMetadata('confirmation');
         if (!$confirmationKey) {
             $confirmationKey = $this->_getRandomConfirmationKey();
         }
         $element = $fieldset->addField('confirmation', 'select', array('name' => 'confirmation', 'label' => __($confirmationAttr->getFrontendLabel())));
         $element->setEntityAttribute($confirmationAttr);
         $element->setValues(array('' => 'Confirmed', $confirmationKey => 'Not confirmed'));
         // Prepare send welcome email checkbox if customer is not confirmed
         // no need to add it, if website ID is empty
         if ($customerData->getConfirmation() && $customerData->getWebsiteId()) {
             $fieldset->addField('sendemail', 'checkbox', array('name' => 'sendemail', 'label' => __('Send Welcome Email after Confirmation')));
             return array('sendemail' => '1');
         }
     }
     return array();
 }
Example #24
0
 /**
  * Adding synonym-related fields
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset     $fieldset The fieldset
  * @param \Smile\ElasticsuiteThesaurus\Model\Thesaurus|null $model    Current Thesaurus
  *
  * @return \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Edit\Form
  */
 private function addSynonymFields($fieldset, $model)
 {
     $form = $fieldset->getForm();
     /* @var $synonymsRenderer \Smile\ElasticsuiteThesaurus\Block\Adminhtml\Thesaurus\Renderer\Synonym */
     $synonymsRenderer = $this->getLayout()->createBlock('Smile\\ElasticsuiteThesaurus\\Block\\Adminhtml\\Thesaurus\\Renderer\\Synonyms')->setForm($fieldset->getForm());
     $fieldset = $form->addFieldset('synonyms_fieldset', ['legend' => __('Synonyms')]);
     $fieldset->addField('synonyms', 'note', []);
     $form->getElement('synonyms_fieldset')->setName('terms_relations')->setValue($model->getTermsData())->setRenderer($synonymsRenderer);
     $form->getElement('synonyms_fieldset')->getRenderer()->setValues($model->getTermsData());
     return $this;
 }
Example #25
0
 /**
  * Add password input fields
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @param string $passwordLabel
  * @param string $confirmationLabel
  * @param bool $isRequired
  * @return void
  */
 protected function _addPasswordFields(\Magento\Framework\Data\Form\Element\Fieldset $fieldset, $passwordLabel, $confirmationLabel, $isRequired = false)
 {
     $requiredFieldClass = $isRequired ? ' required-entry' : '';
     $fieldset->addField('password', 'password', ['name' => 'password', 'label' => $passwordLabel, 'id' => 'customer_pass', 'title' => $passwordLabel, 'class' => 'input-text validate-admin-password' . $requiredFieldClass, 'required' => $isRequired]);
     $fieldset->addField('confirmation', 'password', ['name' => 'password_confirmation', 'label' => $confirmationLabel, 'id' => 'confirmation', 'title' => $confirmationLabel, 'class' => 'input-text validate-cpassword' . $requiredFieldClass, 'required' => $isRequired]);
 }
 /**
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @param string $moduleName
  * @return mixed
  */
 protected function _getFieldHtml($fieldset, $moduleName)
 {
     $configData = $this->getConfigData();
     $path = 'advanced/modules_disable_output/' . $moduleName;
     //TODO: move as property of form
     if (isset($configData[$path])) {
         $data = $configData[$path];
         $inherit = false;
     } else {
         $data = (int) (string) $this->getForm()->getConfigValue($path);
         $inherit = true;
     }
     $element = $this->_getDummyElement();
     $field = $fieldset->addField($moduleName, 'select', ['name' => 'groups[modules_disable_output][fields][' . $moduleName . '][value]', 'label' => $moduleName, 'value' => $data, 'values' => $this->_getValues(), 'inherit' => $inherit, 'can_use_default_value' => $this->getForm()->canUseDefaultValue($element), 'can_use_website_value' => $this->getForm()->canUseWebsiteValue($element)])->setRenderer($this->_getFieldRenderer());
     return $field->toHtml();
 }
Example #27
0
 /**
  * Prepare store element
  *
  * @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
  * @return void
  */
 protected function _prepareStoreElement($fieldset)
 {
     if ($this->_storeManager->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'hidden', ['name' => 'store_id', 'value' => $this->_storeManager->getStore(true)->getId()]);
     } else {
         $storeElement = $fieldset->addField('store_id', 'select', ['label' => __('Store'), 'title' => __('Store'), 'name' => 'store_id', 'required' => true, 'value' => $this->_formValues['store_id']]);
         try {
             $stores = $this->_getStoresListRestrictedByEntityStores($this->_getEntityStores());
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
             $stores = [];
             $storeElement->setAfterElementHtml($e->getMessage());
         }
         $storeElement->setValues($stores);
         if ($this->_getModel()->getIsAutogenerated()) {
             $storeElement->setReadonly(true);
         }
         /** @var $renderer \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element */
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $storeElement->setRenderer($renderer);
     }
 }
Example #28
-3
 /**
  * Add a field to the form or fieldset
  * Form and fieldset have same abstract
  *
  * @param \Magento\Framework\Data\Form|\Magento\Framework\Data\Form\Element\Fieldset $formOrFieldset
  * @param string $elementName
  * @param array $options
  * @param string $type
  * @return \Magento\Framework\Data\Form\Element\AbstractElement
  */
 protected function _addField($formOrFieldset, $elementName, $options = array(), $type = 'text')
 {
     $options = array_merge($options, array('name' => $elementName, 'label' => $this->_recurringPaymentFields->getFieldLabel($elementName), 'note' => $this->_recurringPaymentFields->getFieldComment($elementName), 'disabled' => $this->_isReadOnly));
     if (in_array($elementName, array('period_unit', 'period_frequency'))) {
         $options['required'] = true;
     }
     return $formOrFieldset->addField($elementName, $type, $options);
 }