當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Store::getStoreValuesForForm方法代碼示例

本文整理匯總了PHP中Magento\Store\Model\System\Store::getStoreValuesForForm方法的典型用法代碼示例。如果您正苦於以下問題:PHP Store::getStoreValuesForForm方法的具體用法?PHP Store::getStoreValuesForForm怎麽用?PHP Store::getStoreValuesForForm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Store\Model\System\Store的用法示例。


在下文中一共展示了Store::getStoreValuesForForm方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _prepareForm

 /**
  * Prepare add review form
  *
  * @return void
  */
 protected function _prepareForm()
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $fieldset = $form->addFieldset('add_review_form', array('legend' => __('Review Details')));
     $fieldset->addField('product_name', 'note', array('label' => __('Product'), 'text' => 'product_name'));
     $fieldset->addField('detailed_rating', 'note', array('label' => __('Product Rating'), 'required' => true, 'text' => '<div id="rating_detail">' . $this->getLayout()->createBlock('Magento\\Review\\Block\\Adminhtml\\Rating\\Detailed')->toHtml() . '</div>'));
     $fieldset->addField('status_id', 'select', array('label' => __('Status'), 'required' => true, 'name' => 'status_id', 'values' => $this->_reviewData->getReviewStatusesOptionArray()));
     /**
      * Check is single store mode
      */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('select_stores', 'multiselect', array('label' => __('Visible In'), 'required' => true, 'name' => 'select_stores[]', 'values' => $this->_systemStore->getStoreValuesForForm()));
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     }
     $fieldset->addField('nickname', 'text', array('name' => 'nickname', 'title' => __('Nickname'), 'label' => __('Nickname'), 'maxlength' => '50', 'required' => true));
     $fieldset->addField('title', 'text', array('name' => 'title', 'title' => __('Summary of Review'), 'label' => __('Summary of Review'), 'maxlength' => '255', 'required' => true));
     $fieldset->addField('detail', 'textarea', array('name' => 'detail', 'title' => __('Review'), 'label' => __('Review'), 'style' => 'height: 600px;', 'required' => true));
     $fieldset->addField('product_id', 'hidden', array('name' => 'product_id'));
     /*$gridFieldset = $form->addFieldset('add_review_grid', array('legend' => __('Please select a product')));
       $gridFieldset->addField('products_grid', 'note', array(
       'text' => $this->getLayout()->createBlock('Magento\Review\Block\Adminhtml\Product\Grid')->toHtml(),
       ));*/
     $form->setMethod('post');
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('review/product/post'));
     $this->setForm($form);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:35,代碼來源:Form.php

示例2: _prepareForm

 /**
  * Prepare form fields
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     $model = $this->_coreRegistry->registry('current_catalog_search');
     /* @var $model \Magento\CatalogSearch\Model\Query */
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(array('data' => array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General Information')));
     $yesno = array(array('value' => 0, 'label' => __('No')), array('value' => 1, 'label' => __('Yes')));
     if ($model->getId()) {
         $fieldset->addField('query_id', 'hidden', array('name' => 'query_id'));
     }
     $fieldset->addField('query_text', 'text', array('name' => 'query_text', 'label' => __('Search Query'), 'title' => __('Search Query'), 'required' => true));
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => __('Store'), 'title' => __('Store'), 'values' => $this->_systemStore->getStoreValuesForForm(true, false), 'required' => true));
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id'));
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     if ($model->getId()) {
         $fieldset->addField('num_results', 'text', array('name' => 'num_results', 'label' => __('Number of results'), 'title' => __('Number of results (For the last time placed)'), 'note' => __('For the last time placed.'), 'required' => true));
         $fieldset->addField('popularity', 'text', array('name' => 'popularity', 'label' => __('Number of Uses'), 'title' => __('Number of Uses'), 'required' => true));
     }
     $fieldset->addField('synonym_for', 'text', array('name' => 'synonym_for', 'label' => __('Synonym For'), 'title' => __('Synonym For'), 'note' => __('Will make search for the query above return results for this search')));
     $fieldset->addField('redirect', 'text', array('name' => 'redirect', 'label' => __('Redirect URL'), 'title' => __('Redirect URL'), 'class' => 'validate-url', 'note' => __('ex. http://domain.com')));
     $fieldset->addField('display_in_terms', 'select', array('name' => 'display_in_terms', 'label' => __('Display in Suggested Terms'), 'title' => __('Display in Suggested Terms'), 'values' => $yesno));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:37,代碼來源:Form.php

示例3: _prepareForm

 /**
  * @return $this
  */
 protected function _prepareForm()
 {
     $model = $this->_coreRegistry->registry('checkout_agreement');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(array('data' => array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post')));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('Terms and Conditions Information'), 'class' => 'fieldset-wide'));
     if ($model->getId()) {
         $fieldset->addField('agreement_id', 'hidden', array('name' => 'agreement_id'));
     }
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => __('Condition Name'), 'title' => __('Condition Name'), 'required' => true));
     $fieldset->addField('is_active', 'select', array('label' => __('Status'), 'title' => __('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => __('Enabled'), '0' => __('Disabled'))));
     $fieldset->addField('is_html', 'select', array('label' => __('Show Content as'), 'title' => __('Show Content as'), 'name' => 'is_html', 'required' => true, 'options' => array(0 => __('Text'), 1 => __('HTML'))));
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, true)));
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()));
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $fieldset->addField('checkbox_text', 'editor', array('name' => 'checkbox_text', 'label' => __('Checkbox Text'), 'title' => __('Checkbox Text'), 'rows' => '5', 'cols' => '30', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => __('Content'), 'title' => __('Content'), 'style' => 'height:24em;', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content_height', 'text', array('name' => 'content_height', 'label' => __('Content Height (css)'), 'title' => __('Content Height'), 'maxlength' => 25, 'class' => 'validate-css-length'));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:31,代碼來源:Form.php

示例4: _prepareForm

 /**
  * Initialise form fields
  *
  * @return void
  */
 protected function _prepareForm()
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $fieldset = $form->addFieldset('general', array('legend' => __('General Settings')));
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', array('label' => __('Store'), 'title' => __('Store'), 'values' => $this->_systemStore->getStoreValuesForForm(), 'name' => 'store_id', 'required' => true));
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => $this->_storeManager->getStore(true)->getId()));
     }
     /** @var $label \Magento\Framework\View\Design\Theme\Label */
     $label = $this->_labelFactory->create();
     $options = $label->getLabelsCollection(__('-- Please Select --'));
     $fieldset->addField('design', 'select', array('label' => __('Custom Design'), 'title' => __('Custom Design'), 'values' => $options, 'name' => 'design', 'required' => true));
     $dateFormat = $this->_localeDate->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => __('Date From'), 'title' => __('Date From'), 'name' => 'date_from', 'image' => $this->getViewFileUrl('images/grid-cal.gif'), 'date_format' => $dateFormat));
     $fieldset->addField('date_to', 'date', array('label' => __('Date To'), 'title' => __('Date To'), 'name' => 'date_to', 'image' => $this->getViewFileUrl('images/grid-cal.gif'), 'date_format' => $dateFormat));
     $formData = $this->_backendSession->getDesignData(true);
     if (!$formData) {
         $formData = $this->_coreRegistry->registry('design')->getData();
     } else {
         $formData = $formData['design'];
     }
     $form->addValues($formData);
     $form->setFieldNameSuffix('design');
     $this->setForm($form);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:34,代碼來源:General.php

示例5: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     $model = $this->_coreRegistry->registry('cms_block');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]);
     $form->setHtmlIdPrefix('block_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('General Information'), 'class' => 'fieldset-wide']);
     if ($model->getBlockId()) {
         $fieldset->addField('block_id', 'hidden', ['name' => 'block_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Block Title'), 'title' => __('Block Title'), 'required' => true]);
     $fieldset->addField('identifier', 'text', ['name' => 'identifier', 'label' => __('Identifier'), 'title' => __('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier']);
     /* Check is single store mode */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, true)]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'is_active', 'required' => true, 'options' => ['1' => __('Enabled'), '0' => __('Disabled')]]);
     if (!$model->getId()) {
         $model->setData('is_active', '1');
     }
     $fieldset->addField('content', 'editor', ['name' => 'content', 'label' => __('Content'), 'title' => __('Content'), 'style' => 'height:36em', 'required' => true, 'config' => $this->_wysiwygConfig->getConfig()]);
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:36,代碼來源:Form.php

示例6: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var $model \Magento\Cms\Model\Page */
     $model = $this->_coreRegistry->registry('team');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Team Content')]);
     $fieldset->addField('slogan', 'text', ['name' => 'slogan', 'label' => __('Team Slogan'), 'title' => __('Team Slogan'), 'required' => true]);
     $fieldset->addField('team_color', 'text', ['name' => 'team_color', 'label' => __('Team Color'), 'title' => __('Team Color'), 'class' => 'jscolor {refine:false}']);
     /**
      * Check is single store mode
      */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, true)]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:vishalktpl,項目名稱:CHAT,代碼行數:30,代碼來源:Content.php

示例7: aroundSetForm

 /**
  * @param FrontTab $subject
  * @param callable $proceed
  * @param Form $form
  * @return Front
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundSetForm(FrontTab $subject, \Closure $proceed, Form $form)
 {
     $block = $proceed($form);
     /** @var Fieldset $fieldset */
     $fieldset = $form->getElement('front_fieldset');
     $fieldset->addField('advanced_search_store_ids', 'multiselect', ['name' => 'advanced_search_store_ids[]', 'label' => __('Advanced Search Store(s)'), 'title' => __('Advanced Search Store(s)'), 'value' => 0, 'values' => $this->_systemStore->getStoreValuesForForm(false, true)], 'is_visible_in_advanced_search');
     $subject->getChildBlock('form_after')->addFieldMap('advanced_search_store_ids', 'advanced_search_store_ids')->addFieldDependence('advanced_search_store_ids', 'advanced_search', '1')->addFieldDependence('advanced_search_store_ids', 'searchable', '1');
     return $block;
 }
開發者ID:Genmato,項目名稱:M2_MultistoreSearchFields,代碼行數:16,代碼來源:Front.php

示例8: _prepareForm

 /**
  * Prepare form for newsletter queue editing.
  * Form can be run from newsletter template grid by option "Queue newsletter"
  * or from  newsletter queue grid by edit option.
  *
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     /* @var $queue \Magento\Newsletter\Model\Queue */
     $queue = $this->getQueue();
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Queue Information'), 'class' => 'fieldset-wide']);
     $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM);
     $timeFormat = $this->_localeDate->getTimeFormat(\IntlDateFormatter::MEDIUM);
     if ($queue->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_NEVER) {
         $fieldset->addField('date', 'date', ['name' => 'start_at', 'date_format' => $dateFormat, 'time_format' => $timeFormat, 'label' => __('Queue Date Start')]);
         if (!$this->_storeManager->hasSingleStore()) {
             $fieldset->addField('stores', 'multiselect', ['name' => 'stores[]', 'label' => __('Subscribers From'), 'values' => $this->_systemStore->getStoreValuesForForm(), 'value' => $queue->getStores()]);
         } else {
             $fieldset->addField('stores', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         }
     } else {
         $fieldset->addField('date', 'date', ['name' => 'start_at', 'disabled' => 'true', 'style' => 'width:38%;', 'date_format' => $dateFormat, 'time_format' => $timeFormat, 'label' => __('Queue Date Start')]);
         if (!$this->_storeManager->hasSingleStore()) {
             $fieldset->addField('stores', 'multiselect', ['name' => 'stores[]', 'label' => __('Subscribers From'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(), 'value' => $queue->getStores()]);
         } else {
             $fieldset->addField('stores', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         }
     }
     if ($queue->getQueueStartAt()) {
         $form->getElement('date')->setValue($this->_localeDate->date(new \DateTime($queue->getQueueStartAt())));
     }
     $fieldset->addField('subject', 'text', ['name' => 'subject', 'label' => __('Subject'), 'required' => true, 'value' => $queue->isNew() ? $queue->getTemplate()->getTemplateSubject() : $queue->getNewsletterSubject()]);
     $fieldset->addField('sender_name', 'text', ['name' => 'sender_name', 'label' => __('Sender Name'), 'title' => __('Sender Name'), 'required' => true, 'value' => $queue->isNew() ? $queue->getTemplate()->getTemplateSenderName() : $queue->getNewsletterSenderName()]);
     $fieldset->addField('sender_email', 'text', ['name' => 'sender_email', 'label' => __('Sender Email'), 'title' => __('Sender Email'), 'class' => 'validate-email', 'required' => true, 'value' => $queue->isNew() ? $queue->getTemplate()->getTemplateSenderEmail() : $queue->getNewsletterSenderEmail()]);
     $widgetFilters = ['is_email_compatible' => 1];
     $wysiwygConfig = $this->_wysiwygConfig->getConfig(['widget_filters' => $widgetFilters]);
     if ($queue->isNew()) {
         $fieldset->addField('text', 'editor', ['name' => 'text', 'label' => __('Message'), 'state' => 'html', 'required' => true, 'value' => $queue->getTemplate()->getTemplateText(), 'style' => 'height: 600px;', 'config' => $wysiwygConfig]);
         $fieldset->addField('styles', 'textarea', ['name' => 'styles', 'label' => __('Newsletter Styles'), 'container_id' => 'field_newsletter_styles', 'value' => $queue->getTemplate()->getTemplateStyles()]);
     } elseif (\Magento\Newsletter\Model\Queue::STATUS_NEVER != $queue->getQueueStatus()) {
         $fieldset->addField('text', 'textarea', ['name' => 'text', 'label' => __('Message'), 'value' => $queue->getNewsletterText()]);
         $fieldset->addField('styles', 'textarea', ['name' => 'styles', 'label' => __('Newsletter Styles'), 'value' => $queue->getNewsletterStyles()]);
         $form->getElement('text')->setDisabled('true')->setRequired(false);
         $form->getElement('styles')->setDisabled('true')->setRequired(false);
         $form->getElement('subject')->setDisabled('true')->setRequired(false);
         $form->getElement('sender_name')->setDisabled('true')->setRequired(false);
         $form->getElement('sender_email')->setDisabled('true')->setRequired(false);
         $form->getElement('stores')->setDisabled('true');
     } else {
         $fieldset->addField('text', 'editor', ['name' => 'text', 'label' => __('Message'), 'state' => 'html', 'required' => true, 'value' => $queue->getNewsletterText(), 'style' => 'height: 600px;', 'config' => $wysiwygConfig]);
         $fieldset->addField('styles', 'textarea', ['name' => 'styles', 'label' => __('Newsletter Styles'), 'value' => $queue->getNewsletterStyles(), 'style' => 'height: 300px;']);
     }
     $this->setForm($form);
     return $this;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:61,代碼來源:Form.php

示例9: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     //Magento\Backend\Model\Session
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]);
     $form->setUseContainer(true);
     $data = $this->_coreRegistry->registry('import_config')->getData();
     /*
      * Checking if user have permissions to save information
      */
     if ($this->_authorization->isAllowed('Magefan_Blog::import')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     $isElementDisabled = false;
     $form->setHtmlIdPrefix('import_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => '']);
     $fieldset->addField('type', 'hidden', ['name' => 'type', 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('notice', 'label', ['label' => __('NOTICE'), 'name' => 'prefix', 'after_element_html' => 'When the import is completed successfully, please copy image files from WordPress <strong style="color:#bd1616;">wp-content/uploads</strong> directory to Magento <strong style="color:#105610;">pub/media/magefan_blog</strong> directory.']);
     $fieldset->addField('dbname', 'text', ['name' => 'dbname', 'label' => __('Database Name'), 'title' => __('Database Name'), 'required' => true, 'disabled' => $isElementDisabled, 'after_element_html' => '<small>The name of the database you run in WP.</small>']);
     $fieldset->addField('uname', 'text', ['label' => __('User Name'), 'title' => __('User Name'), 'name' => 'uname', 'required' => true, 'disabled' => $isElementDisabled, 'after_element_html' => '<small>Your WP MySQL username.</small>']);
     $fieldset->addField('pwd', 'text', ['label' => __('Password'), 'title' => __('Password'), 'name' => 'pwd', 'required' => true, 'disabled' => $isElementDisabled, 'after_element_html' => '<small>…and your WP MySQL password.</small>']);
     $fieldset->addField('dbhost', 'text', ['label' => __('Database Host'), 'title' => __('Database Host'), 'name' => 'dbhost', 'required' => true, 'disabled' => $isElementDisabled, 'after_element_html' => '<small>…and your WP MySQL host.</small>']);
     $fieldset->addField('prefix', 'text', ['label' => __('Table Prefix'), 'title' => __('Table Prefix'), 'name' => 'prefix', 'required' => true, 'disabled' => $isElementDisabled, 'after_element_html' => '<small>…and your WP MySQL table prefix.</small>']);
     /**
      * Check is single store mode
      */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', ['name' => 'store_id', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, false), 'disabled' => $isElementDisabled]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'store_id', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $data['store_id'] = $this->_storeManager->getStore(true)->getId();
     }
     $this->_eventManager->dispatch('magefan_blog_import_wordpress_prepare_form', ['form' => $form]);
     /*if (empty($data['homepageurl'])) {
           $data['homepageurl'] = $this->getUrl('blog', ['_store' => 1]);
       }*/
     if (empty($data['prefix'])) {
         $data['prefix'] = 'wp_';
     }
     if (empty($data['dbhost'])) {
         $data['dbhost'] = 'localhost';
     }
     $data['type'] = 'wordpress';
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:magefan,項目名稱:module-blog,代碼行數:55,代碼來源:Form.php

示例10: getAllOptions

 /**
  * @return array
  */
 public function getAllOptions()
 {
     if (!$this->_options) {
         $collection = $this->_createStoresCollection();
         if ('store_id' == $this->getAttribute()->getAttributeCode()) {
             $collection->setWithoutDefaultFilter();
         }
         $this->_options = $this->_store->getStoreValuesForForm();
         if ('created_in' == $this->getAttribute()->getAttributeCode()) {
             array_unshift($this->_options, ['value' => '0', 'label' => __('Admin')]);
         }
     }
     return $this->_options;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:Store.php

示例11: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var \Swissup\Easytabs\Model\Data $model */
     $model = $this->_coreRegistry->registry('easytab');
     /*
      * Checking if user have permissions to save information
      */
     if ($this->_isAllowedAction('Swissup_Easytabs::save')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data']]);
     $form->setHtmlIdPrefix('easytab_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Tab Information')]);
     if ($model->getTabId()) {
         $fieldset->addField('tab_id', 'hidden', ['name' => 'tab_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Title'), 'title' => __('title'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('alias', 'text', ['name' => 'alias', 'label' => __('Alias'), 'title' => __('Alias'), 'required' => true, 'disabled' => $isElementDisabled]);
     $block = $model->getBlock();
     $blockTypes = $this->_getBlockTypes();
     if (!isset($blockTypes[$block])) {
         $model->setBlock('Swissup\\Easytabs\\Block\\Tab\\Html');
     }
     $model->setBlockType($model->getBlock());
     $fieldset->addField('block_type', 'select', ['name' => 'block_type', 'label' => __('Block Type'), 'title' => __('Block Type'), 'required' => true, 'options' => $this->_getBlockTypes(), 'disabled' => $isElementDisabled, 'after_element_html' => $this->_getWidgetSelectAfterHtml()]);
     $fieldset->addField('block', 'text', ['name' => 'block', 'label' => __('Block'), 'title' => __('Block'), 'required' => true, 'disabled' => true]);
     $sortOrder = $model->getSortOrder();
     if (empty($sortOrder)) {
         $model->setSortOrder(0);
     }
     $fieldset->addField('sort_order', 'text', ['name' => 'sort_order', 'label' => __('Sort Order'), 'title' => __('Sort Order'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('status', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'status', 'required' => true, 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled]);
     /* Check is single store mode */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->systemStore->getStoreValuesForForm(false, true), 'disabled' => $isElementDisabled]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:swissup,項目名稱:easytabs,代碼行數:54,代碼來源:Form.php

示例12: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /* @var $model \Magefan\Blog\Model\Category */
     $model = $this->_coreRegistry->registry('current_model');
     /*
      * Checking if user have permissions to save information
      */
     $isElementDisabled = !$this->_isAllowedAction('Magefan_Blog::category');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('category_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Category Information')]);
     if ($model->getId()) {
         $fieldset->addField('category_id', 'hidden', ['name' => 'id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Category Title'), 'title' => __('Category Title'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('is_active', 'select', ['label' => __('Status'), 'title' => __('Category Status'), 'name' => 'is_active', 'required' => true, 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled]);
     if (!$model->getId()) {
         $model->setData('is_active', $isElementDisabled ? '0' : '1');
     }
     $fieldset->addField('identifier', 'text', ['name' => 'identifier', 'label' => __('URL Key'), 'title' => __('URL Key'), 'class' => 'validate-identifier', 'note' => __('Relative to Web Site Base URL'), 'disabled' => $isElementDisabled]);
     /**
      * Check is single store mode
      */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, true), 'disabled' => $isElementDisabled]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $categories[] = ['label' => __('Please select'), 'value' => 0];
     $collection = $this->_categoryCollection->addFieldToFilter('category_id', array('neq' => $model->getId()))->setOrder('position')->getTreeOrderedArray();
     foreach ($collection as $item) {
         if (!$model->isChild($item)) {
             $categories[] = array('label' => $this->_getSpaces($item->getLevel()) . ' ' . $item->getTitle() . ($item->getIsActive() ? '' : ' (' . __('Disabled') . ')'), 'value' => ($item->getPath() ? $item->getPath() . '/' : '') . $item->getId());
         }
     }
     if (count($categories)) {
         $field = $fieldset->addField('path', 'select', ['name' => 'path', 'label' => __('Parent Category'), 'title' => __('Parent Category'), 'values' => $categories, 'disabled' => $isElementDisabled, 'style' => 'width:100%']);
     }
     $fieldset->addField('position', 'text', ['name' => 'position', 'label' => __('Position'), 'title' => __('Position'), 'disabled' => $isElementDisabled]);
     $this->_eventManager->dispatch('magefan_blog_category_edit_tab_main_prepare_form', ['form' => $form]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:samitrimal,項目名稱:Blog-Extension-for-Magento-2,代碼行數:53,代碼來源:Main.php

示例13: _prepareForm

 /**
  * Prepare the form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var \Sample\News\Model\Author $author */
     $author = $this->_coreRegistry->registry('sample_news_author');
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('author_');
     $form->setFieldNameSuffix('author');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Stores'), 'class' => 'fieldset-wide']);
     $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->systemStore->getStoreValuesForForm(false, true)]);
     /** @var \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element $renderer */
     $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
     $field->setRenderer($renderer);
     $form->addValues($author->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:sz-bill,項目名稱:Magento2.x,代碼行數:21,代碼來源:Stores.php

示例14: _prepareForm

 /**
  * Prepare form before rendering HTML
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     $widgetInstance = $this->getWidgetInstance();
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]);
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Storefront Properties')]);
     if ($widgetInstance->getId()) {
         $fieldset->addField('instance_id', 'hidden', ['name' => 'instance_id']);
     }
     $this->_addElementTypes($fieldset);
     $fieldset->addField('instance_code', 'select', ['name' => 'instance_code', 'label' => __('Type'), 'title' => __('Type'), 'class' => '', 'values' => $this->getTypesOptionsArray(), 'disabled' => true]);
     /** @var $label \Magento\Framework\View\Design\Theme\Label */
     $label = $this->_themeLabelFactory->create();
     $options = $label->getLabelsCollection(__('-- Please Select --'));
     $fieldset->addField('theme_id', 'select', ['name' => 'theme_id', 'label' => __('Design Package/Theme'), 'title' => __('Design Package/Theme'), 'required' => false, 'values' => $options, 'disabled' => true]);
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Widget Instance Title'), 'title' => __('Widget Instance Title'), 'class' => '', 'required' => true]);
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_ids', 'multiselect', ['name' => 'store_ids[]', 'label' => __('Assign to Store Views'), 'title' => __('Assign to Store Views'), 'required' => true, 'values' => $this->_store->getStoreValuesForForm(false, true)]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     }
     $fieldset->addField('sort_order', 'text', ['name' => 'sort_order', 'label' => __('Sort Order'), 'title' => __('Sort Order'), 'class' => '', 'required' => false, 'note' => __('Sort Order of widget instances in the same container')]);
     /* @var $layoutBlock \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main\Layout */
     $layoutBlock = $this->getLayout()->createBlock('Magento\\Widget\\Block\\Adminhtml\\Widget\\Instance\\Edit\\Tab\\Main\\Layout')->setWidgetInstance($widgetInstance);
     $fieldset = $form->addFieldset('layout_updates_fieldset', ['legend' => __('Layout Updates')]);
     $fieldset->addField('layout_updates', 'note', []);
     $form->getElement('layout_updates_fieldset')->setRenderer($layoutBlock);
     $this->setForm($form);
     return parent::_prepareForm();
 }
開發者ID:shazal,項目名稱:magento2,代碼行數:36,代碼來源:Main.php

示例15: _getAllStores

 /**
  * Get request stores
  *
  * @return array
  */
 protected function _getAllStores()
 {
     if ($this->_allStores === null) {
         $this->_allStores = $this->_systemStore->getStoreValuesForForm();
     }
     return $this->_allStores;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:Form.php


注:本文中的Magento\Store\Model\System\Store::getStoreValuesForForm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。