當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。