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


PHP Container::extensionMethod方法代码示例

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


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

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

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

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

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

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

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

示例7: register

 /**
  * Adds addTextOutput() method to Nette\Forms\Container
  */
 public static function register()
 {
     Container::extensionMethod('addTextOutput', function (Container $_this, $value, $label = NULL) {
         $number = TextOutput::$counter;
         TextOutput::$counter++;
         return $_this["textOutput_" . $number] = new TextOutput($value, $label);
     });
 }
开发者ID:pipaslot,项目名称:forms,代码行数:11,代码来源:TextOutput.php

示例8: __construct

 public function __construct(ReservationManager $rm, CarsModel $cm)
 {
     $this->reservationManager = $rm;
     $this->carsModel = $cm;
     Container::extensionMethod('addDatePicker', function (Container $container, $name, $label = NULL) {
         return $container[$name] = new DatePicker($label);
     });
 }
开发者ID:hondem,项目名称:mcpneu,代码行数:8,代码来源:AddReservationFormFactory.php

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

示例10: startup

 protected function startup()
 {
     parent::startup();
     Container::extensionMethod('addDatePicker', function (Container $container, $name, $label = NULL) {
         return $container[$name] = new DatePicker($label);
     });
     $this->setErrorPresenter();
 }
开发者ID:castamir,项目名称:sandbox,代码行数:8,代码来源:BasePresenter.php

示例11: register

 public static function register(Translator $translator)
 {
     Nette\Forms\Container::extensionMethod('enableLocalized', function (\Nette\Application\UI\Form $form) use($translator) {
         $form->setTranslator($translator);
     });
     Nette\Forms\Container::extensionMethod('translate', function (\Nette\Application\UI\Form $form, $message, $count = null, $parameters = array()) use($translator) {
         return $translator->translate($message, $count, $parameters);
     });
 }
开发者ID:DIPcom,项目名称:Localization,代码行数:9,代码来源:Container.php

示例12: registerControls

 public static function registerControls()
 {
     Container::extensionMethod('addDatePicker', function (Container $container, $name, $label = NULL) {
         return $container[$name] = new DatePicker($label);
     });
     Container::extensionMethod('addDateTimePicker', function (Container $container, $name, $label = NULL) {
         return $container[$name] = new DateTimePicker($label);
     });
 }
开发者ID:jirinapravnik,项目名称:common,代码行数:9,代码来源:FormExtension.php

示例13: register

 public static function register()
 {
     $class = __CLASS__;
     \Nette\Forms\Container::extensionMethod('addDate', function (\Nette\Forms\Container $form, $name, $label = null, $type = 'datetime-local') use($class) {
         $component = new $class($label, $type);
         $form->addComponent($component, $name);
         return $component;
     });
 }
开发者ID:svobodni,项目名称:web,代码行数:9,代码来源:DateInput.php

示例14: register

 /**
  * Registrace AntiSpamu.
  * @static
  * @param $systemContainer
  */
 public static function register($systemContainer)
 {
     $class = __CLASS__;
     \Nette\Forms\Container::extensionMethod("addAntiSpam", function (\Nette\Forms\Container $container, $name, $blockingTime = 0, $minimumReadTime = 60) use($class, $systemContainer) {
         $component = new $class($name, $blockingTime, $minimumReadTime);
         $component->setContainer($systemContainer);
         $container->addComponent($component, $name);
         return $component;
     });
 }
开发者ID:jzechy,项目名称:nette-antispam,代码行数:15,代码来源:AntiSpamInput.php

示例15: register

 public static function register()
 {
     $class = __CLASS__;
     \Nette\Forms\Container::extensionMethod('addDate', function (\Nette\Forms\Container $form, $name, $label = null, $type = 'datetime-local') use($class) {
         $component = new $class($label, $type);
         $form->addComponent($component, $name);
         return $component;
     });
     \Nette\Forms\Rules::$defaultMessages[__CLASS__ . '::validateDateInputRange'] = \Nette\Forms\Rules::$defaultMessages[\Nette\Forms\Form::RANGE];
     \Nette\Forms\Rules::$defaultMessages[__CLASS__ . '::validateDateInputValid'] = 'Please enter a valid date.';
 }
开发者ID:pt24,项目名称:DateInput,代码行数:11,代码来源:DateInput.php


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