• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Form\Generic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Backend\Block\Widget\Form\Generic的典型用法代码示例。如果您正苦于以下问题:PHP Generic类的具体用法?PHP Generic怎么用?PHP Generic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Generic类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var \Fc\Faqs\Model\Faq $model */
     $model = $this->_coreRegistry->registry('faqs_faq');
     /** @var \Magento\Framework\Data\Form $form */
     /**
      * @todo check how method works maybe it should be faq most likely just method type
      */
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]);
     $form->setHtmlIdPrefix('faq_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('General Information'), 'class' => 'fieldset-wide']);
     if ($model->getFaqId()) {
         $fieldset->addField('faq_id', 'hidden', ['name' => 'faq_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Faq Title'), 'title' => __('Faq Title'), 'required' => true]);
     $fieldset->addField('faq_identifier', 'text', ['name' => 'faq_identifier', 'label' => __('Faq Identifier'), 'title' => __('Faq Identifier'), 'required' => true, 'class' => 'validate-xml-identifier']);
     $fieldset->addField('is_active', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'is_active', 'required' => true, 'options' => ['1' => __('Enabled'), '0' => __('Disabled')]]);
     /**
      * @todo validate as int
      */
     $fieldset->addField('sort_order', 'text', ['label' => __('Sort Order'), 'title' => __('Sort Order'), 'name' => 'sort_order', 'required' => true]);
     if (!$model->getId()) {
         $model->setData('is_active', '1');
     }
     $fieldset->addField('content', 'editor', ['name' => 'content', 'label' => __('Content'), 'title' => __('Content'), 'style' => 'height:36em', 'required' => true]);
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:TheFrankman,项目名称:magento2-faq,代码行数:35,代码来源:Form.php


示例2: _prepareForm

 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(array('data' => array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data')));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:mrtuvn,项目名称:m2ce.dev,代码行数:7,代码来源:Form.php


示例3: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     $idGroup = $this->getRequest()->getParam('group_id');
     $model = $this->_coreRegistry->registry('layout_elements_form_data');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Element Information')]);
     $fieldset->addType('image', 'OuterEdge\\Layout\\Block\\Adminhtml\\Elements\\Helper\\Image');
     if ($model->getId()) {
         $fieldset->addField('element_id', 'hidden', ['name' => 'element_id']);
         $fieldset->addField('group_id', 'hidden', ['name' => 'group_id']);
     }
     if ($idGroup) {
         $model->setGroupId($idGroup);
         $fieldset->addField('group_id', 'hidden', ['name' => 'group_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Title'), 'title' => __('Title'), 'required' => true]);
     $fieldset->addField('description', 'textarea', ['name' => 'description', 'label' => __('Description'), 'title' => __('Description'), 'required' => true]);
     $fieldset->addField('link', 'text', ['name' => 'link', 'label' => __('Link'), 'title' => __('Link'), 'required' => false]);
     $fieldset->addField('link_text', 'text', ['name' => 'link_text', 'label' => __('Link Text'), 'title' => __('Link Text'), 'required' => false]);
     $fieldset->addField('image', 'image', ['name' => 'image', 'label' => __('Image'), 'title' => __('Image'), 'required' => false, 'note' => 'Allow image type: jpg, jpeg, gif, png']);
     $fieldset->addField('sort_order', 'text', ['name' => 'sort_order', 'label' => __('Sort Order'), 'title' => __('Sort Order'), 'required' => false]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:outeredge,项目名称:magento-layout-module,代码行数:33,代码来源:Main.php


示例4: _prepareForm

 protected function _prepareForm()
 {
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data']]);
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:7,代码来源:Form.php


示例5: _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


示例6: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\Data\FormFactory $formFactory
  * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\CategoryFactory $categoryFactory, array $data = array())
 {
     $this->_jsonEncoder = $jsonEncoder;
     $this->_categoryFactory = $categoryFactory;
     parent::__construct($context, $registry, $formFactory, $data);
     $this->setUseContainer(true);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:15,代码来源:NewCategory.php


示例7: _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


示例8: _prepareForm

 /**
  * Initialise form fields
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     /*
      * Checking if user have permissions to save information
      */
     $isElementDisabled = !$this->_isAllowedAction('Magento_Cms::save');
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(['data' => ['html_id_prefix' => 'page_']]);
     $model = $this->_coreRegistry->registry('cms_page');
     $layoutFieldset = $form->addFieldset('layout_fieldset', ['legend' => __('Page Layout'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled]);
     $layoutFieldset->addField('page_layout', 'select', ['name' => 'page_layout', 'label' => __('Layout'), 'required' => true, 'values' => $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray(), 'disabled' => $isElementDisabled]);
     if (!$model->getId()) {
         $model->setRootTemplate($this->_pageLayout->getDefaultValue());
     }
     $layoutFieldset->addField('layout_update_xml', 'textarea', ['name' => 'layout_update_xml', 'label' => __('Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled]);
     $designFieldset = $form->addFieldset('design_fieldset', ['legend' => __('Custom Design'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled]);
     $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
     $designFieldset->addField('custom_theme_from', 'date', ['name' => 'custom_theme_from', 'label' => __('Custom Design From'), 'date_format' => $dateFormat, 'disabled' => $isElementDisabled, 'class' => 'validate-date validate-date-range date-range-custom_theme-from']);
     $designFieldset->addField('custom_theme_to', 'date', ['name' => 'custom_theme_to', 'label' => __('Custom Design To'), 'date_format' => $dateFormat, 'disabled' => $isElementDisabled, 'class' => 'validate-date validate-date-range date-range-custom_theme-to']);
     $options = $this->_labelFactory->create()->getLabelsCollection(__('-- Please Select --'));
     $designFieldset->addField('custom_theme', 'select', ['name' => 'custom_theme', 'label' => __('Custom Theme'), 'values' => $options, 'disabled' => $isElementDisabled]);
     $designFieldset->addField('custom_page_layout', 'select', ['name' => 'custom_page_layout', 'label' => __('Custom Layout'), 'values' => $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray(true), 'disabled' => $isElementDisabled]);
     $designFieldset->addField('custom_layout_update_xml', 'textarea', ['name' => 'custom_layout_update_xml', 'label' => __('Custom Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled]);
     $this->_eventManager->dispatch('adminhtml_cms_page_edit_tab_design_prepare_form', ['form' => $form]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:34,代码来源:Design.php


示例9: _prepareForm

 /**
  * Prepare form fields
  *
  * @return \Magento\Backend\Block\Widget\Form
  */
 protected function _prepareForm()
 {
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('manufacturer_');
     $form->setFieldNameSuffix('manufacturer');
     $model = $this->_coreRegistry->registry('manufacturer_manufacturer');
     $om = \Magento\Framework\App\ObjectManager::getInstance();
     $reader = $om->get('Magento\\Eav\\Model\\Config')->getAttribute('catalog_product', 'manufacturer');
     $attributeOptions = $reader->getSource()->getAllOptions(true, true);
     $default = array('value' => '', 'label' => 'Choose Brand');
     $i = 0;
     $manufacturer[$i] = $default;
     foreach ($attributeOptions as $key => $value) {
         $i++;
         if ($key != 0) {
             $manufacturer[$i] = $value;
             //$name[$i] = $value['label'];
         }
     }
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('General')]);
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', ['name' => 'id']);
     }
     $fieldset->addField('mfc_id', 'select', ['name' => 'mfc_id', 'label' => __('Manufacturer'), 'required' => true, 'values' => $manufacturer]);
     $fieldset->addField('status', 'select', ['name' => 'status', 'label' => __('Status'), 'options' => $this->_manufacturerStatus->toOptionArray()]);
     $fieldset->addField('position', 'textarea', ['name' => 'position', 'label' => __('Position'), 'required' => true, 'style' => 'height: 15em; width: 30em;']);
     $fieldset->addField('image_path', 'image', array('name' => 'image_path', 'label' => __('Image'), 'title' => __('Image')));
     $wysiwygConfig = $this->_wysiwygConfig->getConfig();
     $fieldset->addField('description', 'editor', ['name' => 'description', 'label' => __('Description'), 'required' => true, 'config' => $wysiwygConfig]);
     $data = $model->getData();
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:rushvisilk,项目名称:mage2-helloworld,代码行数:39,代码来源:Info.php


示例10: _prepareForm

 /**
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _prepareForm()
 {
     $model = $this->_coreRegistry->registry('banner');
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix($this->_banner->getFormFieldHtmlIdPrefix());
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Banner Information')]);
     if ($model->getId()) {
         $fieldset->addField('banner_id', 'hidden', ['name' => 'banner_id']);
     }
     $fieldset->addField('name', 'text', ['name' => 'name', 'label' => __('Banner Name'), 'title' => __('Banner Name'), 'required' => true]);
     $fieldset->addField('status', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'status', 'required' => true, 'options' => ['1' => __('Enabled'), '0' => __('Disabled')]]);
     if (!$model->getId()) {
         $model->setData('status', '1');
     }
     $type = $fieldset->addField('type', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'type', 'required' => true, 'options' => ['1' => __('Image'), '0' => __('Video')]]);
     $imageField = $fieldset->addField('image', 'image', ['title' => __('Banner Image'), 'label' => __('Banner Image'), 'name' => 'image', 'note' => 'Allow image type: jpg, jpeg, gif, png']);
     $imageAltText = $fieldset->addField('image_alt', 'text', ['title' => __('Alt Text'), 'label' => __('Alt Text'), 'name' => 'image_alt', 'note' => 'Used for SEO']);
     $imageUrl = $fieldset->addField('url', 'text', ['title' => __('URL'), 'label' => __('URL'), 'name' => 'url']);
     $imageTarget = $fieldset->addField('target', 'select', ['label' => __('Target'), 'name' => 'target', 'values' => [['value' => \Magebase\Carousel\Model\Banner::BANNER_TARGET_SELF, 'label' => __('New Window with Browser Navigation')], ['value' => \Magebase\Carousel\Model\Banner::BANNER_TARGET_PARENT, 'label' => __('Parent Window with Browser Navigation')], ['value' => \Magebase\Carousel\Model\Banner::BANNER_TARGET_BLANK, 'label' => __('New Window without Browser Navigation')]]]);
     $videoUrl = $fieldset->addField('video', 'text', ['title' => __('Video Url'), 'label' => __('Video Url'), 'name' => 'video']);
     $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
     $timeFormat = $this->_localeDate->getTimeFormat(\IntlDateFormatter::SHORT);
     $style = 'color: #000;background-color: #fff; font-weight: bold; font-size: 13px;';
     $fieldset->addField('start_time', 'date', ['name' => 'start_time', 'label' => __('Starting time'), 'title' => __('Starting time'), 'required' => true, 'readonly' => true, 'style' => $style, 'class' => 'required-entry', 'date_format' => $dateFormat, 'time_format' => $timeFormat, 'note' => $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::SHORT)]);
     $fieldset->addField('end_time', 'date', ['name' => 'end_time', 'label' => __('Ending time'), 'title' => __('Ending time'), 'required' => true, 'readonly' => true, 'style' => $style, 'class' => 'required-entry', 'date_format' => $dateFormat, 'time_format' => $timeFormat, 'note' => $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::SHORT)]);
     $fieldset->addField('order_banner', 'text', ['name' => 'order_banner', 'label' => __('Banner Order'), 'title' => __('Banner Order'), 'required' => true]);
     $form->setValues($model->getData());
     $this->setForm($form);
     $this->setChild('form_after', $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Element\\Dependence')->addFieldMap($type->getHtmlId(), $type->getName())->addFieldMap($imageField->getHtmlId(), $imageField->getName())->addFieldMap($imageAltText->getHtmlId(), $imageAltText->getName())->addFieldMap($imageUrl->getHtmlId(), $imageUrl->getName())->addFieldMap($imageTarget->getHtmlId(), $imageTarget->getName())->addFieldMap($videoUrl->getHtmlId(), $videoUrl->getName())->addFieldDependence($imageField->getName(), $type->getName(), '1')->addFieldDependence($imageAltText->getName(), $type->getName(), '1')->addFieldDependence($imageUrl->getName(), $type->getName(), '1')->addFieldDependence($imageTarget->getName(), $type->getName(), '1')->addFieldDependence($videoUrl->getName(), $type->getName(), '0'));
     return parent::_prepareForm();
 }
开发者ID:igor-lero9,项目名称:magebase_carousel,代码行数:35,代码来源:Banner.php


示例11: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var $model \Ves\Brand\Model\Brand */
     $model = $this->_coreRegistry->registry('ves_brand');
     /**
      * Checking if user have permission to save information
      */
     if ($this->_isAllowedAction('Ves_Brand::group_edit')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('brand_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Group Information')]);
     if ($model->getId()) {
         $fieldset->addField('group_id', 'hidden', ['name' => 'group_id']);
     }
     $fieldset->addField('name', 'text', ['name' => 'name', 'label' => __('Group Name'), 'title' => __('Group Name'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('url_key', 'text', ['name' => 'url_key', 'label' => __('URL Key'), 'title' => __('URL Key'), 'note' => __('Empty to auto create url key'), 'disabled' => $isElementDisabled]);
     $fieldset->addField('position', 'text', ['name' => 'position', 'label' => __('Position'), 'title' => __('Position'), 'disabled' => $isElementDisabled]);
     $fieldset->addField('status', 'select', ['label' => __('Status'), 'title' => __('Page Status'), 'name' => 'status', 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled]);
     $fieldset->addField('shown_in_sidebar', 'select', ['label' => __('Show In Sidebar'), 'title' => __('Show In Sidebar'), 'name' => 'shown_in_sidebar', 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:vasuscoin,项目名称:brand,代码行数:33,代码来源:Main.php


示例12: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /* @var $model \Magento\Cms\Model\Page */
     $model = $this->_coreRegistry->registry('testimonial');
     $isElementDisabled = false;
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('Testimonial Information')));
     if ($model->getId()) {
         $fieldset->addField('testimonial_id', 'hidden', array('name' => 'testimonial_id'));
     }
     $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => __('First Name'), 'title' => __('First Name'), 'required' => true, 'disabled' => $isElementDisabled));
     $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => __('Last Name'), 'title' => __('Last Name'), 'required' => true, 'disabled' => $isElementDisabled));
     $fieldset->addField('email', 'text', array('name' => 'email', 'label' => __('Email'), 'title' => __('Email'), 'required' => true, 'disabled' => $isElementDisabled));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'label' => __('Description Name'), 'title' => __('Description Name'), 'required' => true, 'disabled' => $isElementDisabled));
     $fieldset->addField('status', 'select', array('label' => __('Status'), 'title' => __('Page Status'), 'name' => 'status', 'required' => true, 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled));
     if (!$model->getId()) {
         $model->setData('status', $isElementDisabled ? '2' : '1');
     }
     //$this->_eventManager->dispatch('adminhtml_cms_page_edit_tab_main_prepare_form', array('form' => $form));
     /*if($model->getData('image'))
     		$model->setData('image','testimonialslider/images'.$model->getData('image'));*/
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ktplKunj,项目名称:TestMagento,代码行数:32,代码来源:Testimonial.php


示例13: _prepareForm

 /**
  * Prepare form before rendering HTML
  *
  * @return $this
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     $model = $this->getModel();
     $identity = $this->_scopeConfig->getValue(\Magento\Newsletter\Model\Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     $identityName = $this->_scopeConfig->getValue('trans_email/ident_' . $identity . '/name', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     $identityEmail = $this->_scopeConfig->getValue('trans_email/ident_' . $identity . '/email', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     /** @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' => __('Template Information'), 'class' => 'fieldset-wide']);
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', ['name' => 'id', 'value' => $model->getId()]);
     }
     $fieldset->addField('code', 'text', ['name' => 'code', 'label' => __('Template Name'), 'title' => __('Template Name'), 'required' => true, 'value' => $model->getTemplateCode()]);
     $fieldset->addField('subject', 'text', ['name' => 'subject', 'label' => __('Template Subject'), 'title' => __('Template Subject'), 'required' => true, 'value' => $model->getTemplateSubject()]);
     $fieldset->addField('sender_name', 'text', ['name' => 'sender_name', 'label' => __('Sender Name'), 'title' => __('Sender Name'), 'required' => true, 'value' => $model->getId() !== null ? $model->getTemplateSenderName() : $identityName]);
     $fieldset->addField('sender_email', 'text', ['name' => 'sender_email', 'label' => __('Sender Email'), 'title' => __('Sender Email'), 'class' => 'validate-email', 'required' => true, 'value' => $model->getId() !== null ? $model->getTemplateSenderEmail() : $identityEmail]);
     $widgetFilters = ['is_email_compatible' => 1];
     $wysiwygConfig = $this->_wysiwygConfig->getConfig(['widget_filters' => $widgetFilters]);
     if ($model->isPlain()) {
         $wysiwygConfig->setEnabled(false);
     }
     $fieldset->addField('text', 'editor', ['name' => 'text', 'label' => __('Template Content'), 'title' => __('Template Content'), 'required' => true, 'state' => 'html', 'style' => 'height:36em;', 'value' => $model->getTemplateText(), 'config' => $wysiwygConfig]);
     if (!$model->isPlain()) {
         $fieldset->addField('template_styles', 'textarea', ['name' => 'styles', 'label' => __('Template Styles'), 'container_id' => 'field_template_styles', 'value' => $model->getTemplateStyles()]);
     }
     $form->setAction($this->getUrl('*/*/save'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:37,代码来源:Form.php


示例14: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /* @var $model \Magento\Cms\Model\Page */
     $model = $this->_coreRegistry->registry('news');
     /*
      * Checking if user have permissions to save information
      */
     if ($this->_isAllowedAction('Magentostudy_News::save')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('news_main_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('News Information')]);
     if ($model->getId()) {
         $fieldset->addField('news_id', 'hidden', ['name' => 'news_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('News Title'), 'title' => __('News Title'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('author', 'text', ['name' => 'author', 'label' => __('Author'), 'title' => __('Author'), 'required' => true, 'disabled' => $isElementDisabled]);
     $dateFormat = $this->_localeDate->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_SHORT);
     $fieldset->addField('published_at', 'date', ['name' => 'published_at', 'date_format' => $dateFormat, 'image' => $this->getViewFileUrl('images/grid-cal.gif'), 'value' => $model->getPublishedAt(), 'label' => __('Publishing Date'), 'title' => __('Publishing Date'), 'required' => true]);
     $this->_eventManager->dispatch('adminhtml_news_edit_tab_main_prepare_form', ['form' => $form]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:dineshmalekar,项目名称:magento2-extension-example,代码行数:33,代码来源:Main.php


示例15: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\Data\FormFactory $formFactory
  * @param \Magento\Newsletter\Model\QueueFactory $queueFactory
  * @param \Magento\Store\Model\System\Store $systemStore
  * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, \Magento\Newsletter\Model\QueueFactory $queueFactory, \Magento\Store\Model\System\Store $systemStore, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, array $data = [])
 {
     $this->_wysiwygConfig = $wysiwygConfig;
     $this->_systemStore = $systemStore;
     $this->_queueFactory = $queueFactory;
     parent::__construct($context, $registry, $formFactory, $data);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Form.php


示例16: _prepareForm

 /**
  * Add fields to form and create template info form
  *
  * @return \Magento\Backend\Block\Widget\Form
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Template Information'), 'class' => 'fieldset-wide']);
     $templateId = $this->getEmailTemplate()->getId();
     $fieldset->addField('currently_used_for', 'label', ['label' => __('Currently Used For'), 'container_id' => 'currently_used_for', 'after_element_html' => '<script>require(["prototype"], function () {' . (!$this->getEmailTemplate()->getSystemConfigPathsWhereCurrentlyUsed() ? '$(\'' . 'currently_used_for' . '\').hide(); ' : '') . '});</script>']);
     $fieldset->addField('template_code', 'text', ['name' => 'template_code', 'label' => __('Template Name'), 'required' => true]);
     $fieldset->addField('template_subject', 'text', ['name' => 'template_subject', 'label' => __('Template Subject'), 'required' => true]);
     $fieldset->addField('orig_template_variables', 'hidden', ['name' => 'orig_template_variables']);
     $fieldset->addField('variables', 'hidden', ['name' => 'variables', 'value' => \Zend_Json::encode($this->getVariables())]);
     $fieldset->addField('template_variables', 'hidden', ['name' => 'template_variables']);
     $insertVariableButton = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Button', '', ['data' => ['type' => 'button', 'label' => __('Insert Variable...'), 'onclick' => 'templateControl.openVariableChooser();return false;']]);
     $fieldset->addField('insert_variable', 'note', ['text' => $insertVariableButton->toHtml()]);
     $fieldset->addField('template_text', 'textarea', ['name' => 'template_text', 'label' => __('Template Content'), 'title' => __('Template Content'), 'required' => true, 'style' => 'height:24em;']);
     if (!$this->getEmailTemplate()->isPlain()) {
         $fieldset->addField('template_styles', 'textarea', ['name' => 'template_styles', 'label' => __('Template Styles'), 'container_id' => 'field_template_styles']);
     }
     if ($templateId) {
         $form->addValues($this->getEmailTemplate()->getData());
     }
     $values = $this->_backendSession->getData('email_template_form_data', true);
     if ($values) {
         $form->setValues($values);
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:35,代码来源:Form.php


示例17: _prepareForm

 /**
  * Prepare form
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     /* @var $model \Jk\Test\Model\BlogPosts */
     $model = $this->_coreRegistry->registry('test');
     $isElementDisabled = false;
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Item Information')]);
     if ($model->getId()) {
         $fieldset->addField('test_id', 'hidden', ['name' => 'test_id']);
     }
     $fieldset->addField('title', 'text', ['name' => 'title', 'label' => __('Title'), 'title' => __('Title'), 'required' => true, 'disabled' => $isElementDisabled]);
     $wysiwygConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);
     $contentField = $fieldset->addField('content', 'editor', ['name' => 'content', 'style' => 'height:36em;', 'required' => true, 'disabled' => $isElementDisabled, 'config' => $wysiwygConfig]);
     // Setting custom renderer for content field to remove label column
     $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\\Element')->setTemplate('Magento_Cms::page/edit/form/renderer/content.phtml');
     $contentField->setRenderer($renderer);
     $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
     $fieldset->addField('publish_date', 'date', ['name' => 'publish_date', 'label' => __('Publish Date'), 'date_format' => $dateFormat, 'disabled' => $isElementDisabled, 'class' => 'validate-date validate-date-range date-range-custom_theme-from']);
     $fieldset->addField('is_active', 'select', ['label' => __('Status'), 'title' => __('Status'), 'name' => 'is_active', 'required' => true, 'options' => $this->_status->getOptionArray(), 'disabled' => $isElementDisabled]);
     if (!$model->getId()) {
         $model->setData('is_active', $isElementDisabled ? '0' : '1');
     }
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ktplKunj,项目名称:TestMagento,代码行数:34,代码来源:Main.php


示例18: _prepareForm

 /**
  * Prepare form fields
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     $model = $this->_coreRegistry->registry('current_catalog_search');
     /* @var $model \Magento\Search\Model\Query */
     /** @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' => __('General Information')]);
     $yesno = [['value' => 0, 'label' => __('No')], ['value' => 1, 'label' => __('Yes')]];
     if ($model->getId()) {
         $fieldset->addField('query_id', 'hidden', ['name' => 'query_id']);
     }
     $fieldset->addField('query_text', 'text', ['name' => 'query_text', 'label' => __('Search Query'), 'title' => __('Search Query'), 'required' => true]);
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', ['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', ['name' => 'store_id']);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     if ($model->getId()) {
         $fieldset->addField('num_results', 'text', ['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', ['name' => 'popularity', 'label' => __('Number of Uses'), 'title' => __('Number of Uses'), 'required' => true]);
     }
     $fieldset->addField('redirect', 'text', ['name' => 'redirect', 'label' => __('Redirect URL'), 'title' => __('Redirect URL'), 'class' => 'validate-url', 'note' => __('ex. http://domain.com')]);
     $fieldset->addField('display_in_terms', 'select', ['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:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:37,代码来源:Form.php


示例19: _prepareForm

 /**
  * Add fieldsets
  *
  * @return $this
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareForm()
 {
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getUrl('adminhtml/*/validate'), 'method' => 'post', 'enctype' => 'multipart/form-data']]);
     // base fieldset
     $fie 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Grid\Column类代码示例发布时间:2022-05-23
下一篇:
PHP Form\Container类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap