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