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