当前位置: 首页>>代码示例>>PHP>>正文


PHP Forms\Container类代码示例

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


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

示例1: addToFormContainer

 /**
  * Adds text field to filter form
  * @param Nette\Forms\Container $container
  */
 public function addToFormContainer($container)
 {
     $container->addText($this->key, $this->name);
     if ($this->getPlaceholder()) {
         $container[$this->key]->setAttribute('placeholder', $this->getPlaceholder());
     }
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:11,代码来源:FilterText.php

示例2: addToFormContainer

 /**
  * Adds select box to filter form
  * @param Nette\Forms\Container $container
  */
 public function addToFormContainer($container)
 {
     $container->addText($this->key, $this->name)->setAttribute('data-provide', 'datepicker')->setAttribute('data-date-orientation', 'bottom')->setAttribute('data-date-format', $this->getJsFormat())->setAttribute('data-date-today-highlight', 'true')->setAttribute('data-date-autoclose', 'true');
     if ($this->getPlaceholder()) {
         $container[$this->key]->setAttribute('placeholder', $this->getPlaceholder());
     }
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:11,代码来源:FilterDate.php

示例3: setEntityToContainer

 /**
  * Map Entity to form
  *
  * @param object $entity
  * @param Container $container
  */
 public function setEntityToContainer($entity, Container $container)
 {
     // go throw all components and try find values for it
     /** @var BaseControl $component */
     foreach ($container->getComponents() as $component) {
         $this->mapValueToComponent($entity, $component);
     }
 }
开发者ID:pecinaon,项目名称:doctrine-mapper,代码行数:14,代码来源:EntityFormMapper.php

示例4: addToFormContainer

 /**
  * Adds select box to filter form
  * @param Nette\Forms\Container $container
  */
 public function addToFormContainer($container)
 {
     $form = $container->lookup('Nette\\Application\\UI\\Form');
     $translator = $form->getTranslator();
     $select = $container->addSelect($this->key, $translator->translate($this->name), $this->options);
     if (!$this->translateOptions) {
         $select->setTranslator(NULL);
     }
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:13,代码来源:FilterSelect.php

示例5: entityToForm

 public function entityToForm($entity, Nette\Forms\Container $form)
 {
     foreach ($form->getComponents() as $name => $control) {
         if (isset($entity->{$name})) {
             $form[$name]->setValue($entity->{$name});
         }
     }
     return $form;
 }
开发者ID:zaxcms,项目名称:framework,代码行数:9,代码来源:DoctrineBinder.php

示例6: generateForm

 public function generateForm(Items\Base $item, Nette\Forms\Container &$formContainer, $name, $parentName, $togglingObject, array $userOptions = [])
 {
     $input = $formContainer->addTextArea($name, $name);
     $input->setOption('id', $parentName . '__' . $name);
     $input->setValue($item->getContent());
     if (!is_null($togglingObject)) {
         $togglingObject->toggle($input->getOption('id'));
     }
     $item->applyUserOptions($input, $userOptions);
 }
开发者ID:trejjam,项目名称:contents,代码行数:10,代码来源:TextareaSubType.php

示例7: addToFormContainer

 /**
  * Adds select box to filter form
  * @param Nette\Forms\Container $container
  */
 public function addToFormContainer(Nette\Forms\Container $container)
 {
     $container->addText($this->key, $this->name)->setAttribute('data-provide', 'datepicker')->setAttribute('data-date-orientation', 'bottom')->setAttribute('data-date-format', $this->getJsFormat())->setAttribute('data-date-today-highlight', 'true')->setAttribute('data-date-autoclose', 'true');
     $this->addAttributes($container[$this->key]);
     if ($this->grid->hasAutoSubmit()) {
         $container[$this->key]->setAttribute('data-autosubmit-change', TRUE);
     }
     if ($this->getPlaceholder()) {
         $container[$this->key]->setAttribute('placeholder', $this->getPlaceholder());
     }
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:15,代码来源:FilterDate.php

示例8: generateForm

 public function generateForm(Items\Base $item, Nette\Forms\Container &$formContainer, $name, $parentName, $togglingObject, array $userOptions = [])
 {
     $input = $formContainer->addText($name, $name);
     $input->setOption('id', $parentName . '__' . $name);
     $input->setValue($item->getContent());
     $input->setType('time');
     $input->addCondition(UI\Form::FILLED)->addRule(UI\Form::PATTERN, __('Time must be in format HH:MM'), '([0-9]{2}[-: ]{1}[0-9]{2})');
     if (!is_null($togglingObject)) {
         $togglingObject->toggle($input->getOption('id'));
     }
     $item->applyUserOptions($input, $userOptions);
 }
开发者ID:trejjam,项目名称:contents,代码行数:12,代码来源:TimeSubType.php

示例9: setContainerDefaults

 /**
  * @param Nette\Forms\Container $parent
  * @param string $name
  * @param mixed $values
  */
 protected function setContainerDefaults(Nette\Forms\Container $parent, $name, $values)
 {
     if ($values === NULL) {
         return;
     }
     $component = $parent->getComponent($name);
     $factory = $this->getContainerFactory($name);
     if ($values instanceof IFormEntity) {
         $factory->setDefaultByEntity($component, $values);
     } else {
         $factory->setDefaultByCollection($component, $values);
     }
 }
开发者ID:sw2eu,项目名称:form-factory,代码行数:18,代码来源:TContainerHandler.php

示例10: createImageUpload

 protected function createImageUpload(Nette\Forms\Container $container, $image)
 {
     $id = $this->lookupPath('Nette\\Application\\UI\\Presenter') . '-form';
     if ($image !== NULL) {
         $container->addCheckbox('deleteImg', 'common.form.removeImage')->addCondition(Form::EQUAL, FALSE)->toggle($id . '-pic-customize');
     }
     $container->addFileUpload('img', 'common.form.image')->setOption('id', $id . '-pic-image')->addCondition(Form::FILLED)->addRule(Form::IMAGE);
     // upload is filled => show img options
     $container['img']->addCondition(Form::FILLED)->toggle($id . '-pic-customize');
     // has image and deleteImg is checked => show upload
     if ($image !== NULL) {
         $container['deleteImg']->addCondition(Form::EQUAL, TRUE)->toggle($id . '-pic-image');
     }
 }
开发者ID:zaxxx,项目名称:zaxcms,代码行数:14,代码来源:AbstractFormControl.php

示例11: addControl

 /**
  * @param Nette\Forms\Container $container
  * @param string                $key
  * @param string                $name
  * @param array                $options
  * @return Nette\Forms\Controls\SelectBox
  */
 protected function addControl(Nette\Forms\Container $container, $key, $name, $options)
 {
     /**
      * Set some translated texts
      */
     $form = $container->lookup('Nette\\Application\\UI\\Form');
     $t = [$form->getTranslator(), 'translate'];
     $this->addAttribute('title', $t('ublaboo_datagrid.multiselect_choose'));
     $this->addAttribute('data-i18n-selected', $t('ublaboo_datagrid.multiselect_selected'));
     /**
      * Add input to container
      */
     $input = $container->addMultiSelect($key, $name, $options);
     return $this->addAttributes($input);
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:22,代码来源:FilterMultiSelect.php

示例12: register

 /**
  * Registers this control
  *
  * @return DateTimePicker
  */
 public static function register()
 {
     Container::extensionMethod('addDateTime', function ($container, $name, $label = NULL) {
         $picker = $container[$name] = new DateTimePicker($label);
         return $picker;
     });
 }
开发者ID:pipaslot,项目名称:forms,代码行数:12,代码来源:DateTimePicker.php

示例13: bind

 /**
  * @param string $siteKey
  * @param string $name
  * @return void
  */
 public static function bind($siteKey, $name = 'addReCaptcha')
 {
     // Bind to form container
     Container::extensionMethod($name, function ($container, $name, $label = NULL) use($siteKey) {
         return $container[$name] = new ReCaptchaField($siteKey, $label);
     });
 }
开发者ID:minetro,项目名称:recaptcha,代码行数:12,代码来源:ReCaptchaBinding.php

示例14: register

 public static function register($format = 'yyyy-mm-dd', $language = 'en', $method = 'addDatePicker')
 {
     $class = function_exists('get_called_class') ? get_called_class() : __CLASS__;
     \Nette\Forms\Container::extensionMethod($method, function (\Nette\Forms\Container $container, $name, $label = NULL) use($class, $format, $language) {
         return $container[$name] = new $class($format, $language, $label);
     });
 }
开发者ID:remism,项目名称:bootstrap-nette-datepicker,代码行数:7,代码来源:BootstrapDatePicker.php

示例15: createForm

 protected function createForm()
 {
     $form = new Form();
     Container::extensionMethod('addLazyContainer', function ($container, $name, $factory) {
         return $container[$name] = new LazyContainer($factory);
     });
     $base = $form->addContainer('base');
     $base->addText('name', 'Název');
     $type = $base->addSelect('type', 'Typ položky', $this->menuTypeOptionFactory->getOptionsBySection($this->sectionId));
     $type->setDefaultValue(key($type->getItems()));
     $type->setAttribute('class', 'change-ajax-submit');
     $base->addCheckbox('show', 'Zobrazit')->setDefaultValue(TRUE);
     $parent = $form->addContainer('parent');
     $menu = $parent['id_menu'] = $this->menuFormItemFactory->create($this->sectionId);
     $menu->setPrompt('---');
     $menu->caption = 'Rodičovská kategorie';
     $form->addLazyContainer('content', function (LazyContainer $self) use($form, $type) {
         $values = $self->getFormValues();
         $itemType = $values['base']['type'];
         $this->lazyItemMap->get($itemType)->setup($self, $this->sectionId);
     });
     $form->addSubmit('save', 'Uložit');
     $form->onValidate[] = $this->validateNonCircular;
     $form->onValidate[] = $this->validateAjax;
     $form->onValidate[] = $this->validateLazyItem;
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:27,代码来源:MenuForm.php


注:本文中的Nette\Forms\Container类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。