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


PHP Form::extensionMethod方法代码示例

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


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

示例1: register

 /**
  * Register Antispam to Nette Forms
  * @return void
  */
 public static function register()
 {
     Form::extensionMethod('addAntispam', function (Form $form, $name = 'spam', $label = 'Toto pole vymažte', $msg = 'Byl detekován pokus o spam.') {
         // "All filled" protection
         $form[$name] = new AntispamControl($label, NULL, NULL, $msg);
         // "Send delay" protection
         $form->addHidden('form_created', strtr(time(), '0123456789', 'jihgfedcba'))->addRule(function ($item) {
             if (AntispamControl::$minDelay <= 0) {
                 return TRUE;
             }
             // turn off "Send delay protection"
             $value = (int) strtr($item->value, 'jihgfedcba', '0123456789');
             return $value <= time() - AntispamControl::$minDelay;
         }, $msg);
         return $form;
     });
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:21,代码来源:AntispamControl.php

示例2: register

 /**
  * Adds addTag() method to \Nette\Forms\Form
  */
 public static function register()
 {
     Form::extensionMethod('addTag', callback(__CLASS__, 'addTag'));
 }
开发者ID:svobodni,项目名称:web,代码行数:7,代码来源:TagsInput.php

示例3: function

// Configure application
$configurator = new Nette\Configurator();
// Enable Nette Debugger for error visualisation & logging
//$configurator->setDebugMode(TRUE);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(APP_DIR)->addDirectory(LIBS_DIR)->register();
// Create Dependency Injection container from config.neon file
$environment = Nette\Configurator::detectDebugMode('127.0.0.1') ? $configurator::DEVELOPMENT : $configurator::PRODUCTION;
$configurator->addConfig(__DIR__ . '/config/config.neon', $environment);
$container = $configurator->createContainer();
$container->application->errorPresenter = 'Error';
// DatePicker
\Nette\Forms\Form::extensionMethod('addDatePicker', function (Nette\Forms\Form $_this, $name, $label = NULL, $cols = NULL, $maxLength = NULL) {
    return $_this[$name] = new RadekDostal\NetteComponents\DateTimePicker\DatePicker($label, $cols, $maxLength);
});
// Setup router
// Admin Router
$container->router[] = $adminRouter = new RouteList();
$adminRouter[] = new Route('admin/<presenter>/<action>/<id>', array('module' => 'Admin', 'presenter' => 'Default', 'action' => 'default'));
$adminRouter[] = new Route('admin/<presenter>/<action>', array('module' => 'Admin', 'presenter' => 'Default', 'action' => 'default', 'id' => NULL));
// Front Router
$container->router[] = $frontRouter = new RouteList();
$frontRouter[] = new Route('index.php', array('presenter' => 'Default'), Route::ONE_WAY);
$frontRouter[] = new Route('', array('lang' => 'cs', 'presenter' => 'Default'), Route::ONE_WAY);
$frontRouter[] = new Route('files/vydavatele/certifikat.html', array('presenter' => 'Default', 'action' => 'disclaimer', 'lang' => 'cs'), Route::ONE_WAY);
$frontRouter[] = new Route('certifikat', array('presenter' => 'Default', 'action' => 'graphics', 'lang' => 'cs'), Route::ONE_WAY);
$frontRouter[] = new Route('<lang en|cs>', array('presenter' => 'Default', 'action' => 'default', 'id' => NULL));
/*$frontRouter[] = new Route('cs/klicove-slovo/<keyword>', array(
	'presenter' => 'Default',
开发者ID:WebArchivCZ,项目名称:WWW,代码行数:31,代码来源:bootstrap.php


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