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


PHP Form::getRenderer方法代码示例

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


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

示例1: setupRenderersLayout

 private function setupRenderersLayout()
 {
     $renderer = $this->form->getRenderer();
     if ($renderer instanceof DefaultFormRenderer) {
         $renderer->wrappers['controls']['container'] = NULL;
         $renderer->wrappers['pair']['container'] = 'div class=form-group';
         $renderer->wrappers['pair']['.error'] = 'has-error';
         $renderer->wrappers['control']['container'] = 'div class=col-sm-9';
         $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
         $renderer->wrappers['control']['description'] = 'span class=help-block';
         $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     }
 }
开发者ID:achse,项目名称:bootstrap3-form-decorator,代码行数:13,代码来源:Bootstrap3FormDecorator.php

示例2: renderFormBegin

 /**
  * Renders form begin.
  * @param Form $form
  * @param array $attrs
  * @param bool $withTags
  * @return string
  */
 public static function renderFormBegin(Form $form, array $attrs, $withTags = TRUE)
 {
     $renderer = $form->getRenderer();
     if ($renderer instanceof IManualRenderer) {
         $renderer->beforeRender($form);
     }
     return parent::renderFormBegin($form, $attrs, $withTags);
 }
开发者ID:pipaslot,项目名称:forms,代码行数:15,代码来源:Runtime.php

示例3: unsubscriptionForm

 /**
  * Front-end unsubscription form
  *
  * @return Nette\Forms\Form
  */
 public static function unsubscriptionForm($widget = FALSE, $widgetId = '')
 {
     $form = new Form('unsubscriptionFront' . $widgetId);
     $form->addText('email', 'Your e-mail address')->setRequired('To unsubscribe, you need to fill in your e-mail address.')->addRule(Form::EMAIL, 'Your e-mail address must be valid.');
     $form->addSubmit('submit', 'Unsubscribe')->setAttribute('class', 'subscribeButton');
     // swap renderer for widgets
     if ($widget == TRUE) {
         $renderer = $form->getRenderer();
         $renderer->wrappers['controls']['container'] = 'dl';
         $renderer->wrappers['pair']['container'] = NULL;
         $renderer->wrappers['label']['container'] = 'dt';
         $renderer->wrappers['control']['container'] = 'dd';
     }
     return $form;
 }
开发者ID:hkarriche,项目名称:wordpress,代码行数:20,代码来源:Forms.php

示例4: bootstrapForm

 public static function bootstrapForm(Form $form)
 {
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="form-group"';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class="col-sm-9"';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-shadow' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control form-control-shadow');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
 }
开发者ID:norik16,项目名称:TripMap,代码行数:24,代码来源:Helpers.php

示例5: array

<?php

/**
 * Nette\Forms custom rendering example.
 */
require_once __DIR__ . '/../../Nette/loader.php';
use Nette\Forms\Form, Nette\Debug, Nette\Web\Html;
Debug::enable();
$countries = array('Select your country', 'Europe' => array('CZ' => 'Czech Republic', 'SK' => 'Slovakia', 'GB' => 'United Kingdom'), 'CA' => 'Canada', 'US' => 'United States', '?' => 'other');
$sex = array('m' => Html::el('option', 'male')->style('color: #248bd3'), 'f' => Html::el('option', 'female')->style('color: #e948d4'));
// Step 1: Define form with validation rules
$form = new Form();
// setup custom rendering
$renderer = $form->getRenderer();
$renderer->wrappers['form']['container'] = Html::el('div')->id('form');
$renderer->wrappers['form']['errors'] = FALSE;
$renderer->wrappers['group']['container'] = NULL;
$renderer->wrappers['group']['label'] = 'h3';
$renderer->wrappers['pair']['container'] = NULL;
$renderer->wrappers['controls']['container'] = 'dl';
$renderer->wrappers['control']['container'] = 'dd';
$renderer->wrappers['control']['.odd'] = 'odd';
$renderer->wrappers['control']['errors'] = TRUE;
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['label']['suffix'] = ':';
$renderer->wrappers['control']['requiredsuffix'] = " •";
// group Personal data
$form->addGroup('Personal data');
$form->addText('name', 'Your name')->addRule(Form::FILLED, 'Enter your name');
$form->addText('age', 'Your age')->addRule(Form::FILLED, 'Enter your age')->addRule(Form::INTEGER, 'Age must be numeric value')->addRule(Form::RANGE, 'Age must be in range from %d to %d', array(10, 100));
$form->addSelect('gender', 'Your gender', $sex);
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:custom-rendering.php

示例6: renderFormBegin

 /**
  * @param Form $form
  * @param array $args
  */
 private static function renderFormBegin(Form $form, array $args)
 {
     if ($form->getRenderer() instanceof BootstrapRenderer) {
         $form->render('begin', $args);
     } else {
         Nette\Bridges\FormsLatte\FormMacros::renderFormBegin($form, $args);
     }
 }
开发者ID:josefzajac,项目名称:BootstrapFormRenderer,代码行数:12,代码来源:FormMacros.php


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