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

PHP Forms\Container类代码示例

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

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



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


示例16: register

 public static function register()
 {
     Kdyby\Replicator\Container::register();
     Container::extensionMethod('addHasOne', function (Container $container, $name, $label = NULL, $column = NULL, array $items = NULL) {
         $control = $container[$name] = new HasOneControl($label, $column, $items);
         return $control;
     });
     Container::extensionMethod('addHasMany', function (Container $container, $name, $column = NULL, array $items = NULL) {
         $control = $container[$name] = new HasManyControl($column, $items);
         $control->setCurrentGroup($container->form->getCurrentGroup());
         return $control;
     });
     // WYSIWYG
     Container::extensionMethod('addWysiwyg', function (Container $container, $name, $label = NULL, $rows = NULL, $cols = NULL) {
         $control = $container->addTextArea($name, $label, $cols, $rows);
         $control->getControlPrototype()->class('wysiwyg');
         return $control;
     });
     // E-mail
     Container::extensionMethod('addEmail', function (Container $container, $name, $label = NULL, $cols = NULL, $maxLength = NULL) {
         $control = $container->addText($name, $label, $cols, $maxLength);
         $control->setAttribute('type', 'email');
         $control->addCondition(Form::FILLED)->addRule(Form::EMAIL);
         return $control;
     });
     // URL
     Container::extensionMethod('addUrl', function (Container $container, $name, $label = NULL, $cols = NULL, $maxLength = NULL) {
         $control = $container->addText($name, $label, $cols, $maxLength);
         $control->setAttribute('type', 'url');
         $control->addCondition(Form::FILLED)->addRule(Form::URL);
         return $control;
     });
     // Color
     Container::extensionMethod('addColor', function (Container $container, $name, $label = NULL, $cols = NULL, $maxLength = NULL) {
         $control = $container->addText($name, $label, $cols, $maxLength);
         $control->setAttribute('type', 'color');
         return $control;
     });
     // Number
     Container::extensionMethod('addNumber', function (Container $container, $name, $label = NULL, $step = NULL, $min = NULL, $max = NULL, $cols = NULL, $maxLength = NULL) {
         $control = $container->addText($name, $label, $cols, $maxLength);
         $control->setAttribute('type', 'number');
         $control->setAttribute('step', $step);
         $control->addCondition(Form::FILLED)->addRule(Form::NUMERIC);
         $range = [];
         if ($min !== NULL) {
             $control->setAttribute('min', $min);
             $range[0] = $min;
         }
         if ($max !== NULL) {
             $control->setAttribute('max', $max);
             $range[1] = $max;
         }
         if ($range != [NULL, NULL]) {
             $control->addCondition(Form::FILLED)->addRule(Form::RANGE, NULL, $range);
         }
         return $control;
     });
 }
开发者ID:peterzadori,项目名称:movi,代码行数:59,代码来源:Extension.php


示例17: attached

 /**
  * @param \Nette\ComponentModel\IContainer
  */
 protected function attached($presenter)
 {
     parent::attached($presenter);
     if (!$presenter instanceof Nette\Application\UI\Presenter) {
         return;
     }
     $this->loadHttpData();
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:11,代码来源:ItemDetailForm.php


示例18: register

 public static function register()
 {
     Container::extensionMethod('addGMap', function (Container $form, $name, $label = null) {
         $component = new NetteGMapPicker($label);
         $form->addComponent($component, $name);
         return $component;
     });
 }
开发者ID:venca-x,项目名称:nettegmap,代码行数:8,代码来源:NetteGMapPicker.php


示例19: __call

 /**
  * @param $name
  * @param $args
  * @return \Nette\Forms\Container|Container
  */
 public function __call($name, $args)
 {
     if (substr($name, 0, 3) !== 'add') {
         return parent::__call($name, $args);
     }
     $args = array_merge(array(lcfirst(substr($name, 3))), $args);
     return call_user_func_array(array($this, 'add'), $args);
 }
开发者ID:svobodni,项目名称:web,代码行数:13,代码来源:Container.php


示例20: register

 public static function register()
 {
     \Nette\Forms\Container::extensionMethod('addDate', function (\Nette\Forms\Container $form, $name, $label = null, $type = 'datetime') {
         $component = new NetteDateTime($label, $type);
         $form->addComponent($component, $name);
         return $component;
     });
 }
开发者ID:venca-x,项目名称:nette-date-time,代码行数:8,代码来源:NetteDateTime.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Forms\Form类代码示例发布时间:2022-05-23
下一篇:
PHP Diagnostics\Debugger类代码示例发布时间: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