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


PHP Form::getRenderer方法代码示例

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


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

示例1: __construct

 /**
  * @param Nette\Http\SessionSection $session
  * @param Nette\ComponentModel\IContainer|null $parent
  * @param null $name
  */
 public function __construct(\Nette\Http\SessionSection $session, $parent = NULL, $name = NULL)
 {
     parent::__construct($parent, $name);
     $this->session = $session;
     $this->question = Html::el('p')->addAttributes(array('class' => "{$this->cssClass}--question"));
     $this->form = new Form($this, 'form');
     $this->form->getElementPrototype()->class = "{$this->cssClass}--form";
     $this->form->getRenderer()->wrappers['controls']['container'] = NULL;
     $this->form->addHidden('token');
     $this->form->addSubmit('yes', self::$_strings['yes'])->onClick[] = array($this, 'confirmClicked');
     $this->form->addSubmit('no', self::$_strings['no'])->onClick[] = array($this, 'cancelClicked');
     $this->form['yes']->getControlPrototype()->class = 'btn';
     $this->form['no']->getControlPrototype()->class = 'btn';
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:19,代码来源:ConfirmationDialog.php

示例2: createComponentLogInForm

 /**
  * LogIn-in form factory.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentLogInForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->setTranslator($this->translator->domain('ui'));
     $form->addText('username', 'login-username')->setRequired('please-enter-your-username')->setAttribute('autofocus');
     $form->addPassword('password', 'login-password')->setRequired('');
     $form->addCheckbox('remember', 'keep-me-signed-in');
     $form->addSubmit('send', 'log-in');
     $form->onSuccess[] = $this->logInFormSucceeded;
     // setup form rendering for Twitter Bootstrap
     $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-3';
     $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-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
开发者ID:buffus,项目名称:skeleton,代码行数:36,代码来源:LogInPresenter.php

示例3: createComponentSignInForm

 protected function createComponentSignInForm()
 {
     $form = new Form();
     $form->addText('username', 'Uživatelské jméno:')->setRequired('Prosím vyplňte své uživatelské jméno.');
     $form->addPassword('password', 'Heslo:')->setRequired('Prosím vyplňte své heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen');
     $form->addSubmit('send', 'Přihlásit');
     // 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-6"';
     $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-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = array($this, 'signInFormSucceeded');
     return $form;
 }
开发者ID:pzdesign,项目名称:statekbenatky-nette,代码行数:31,代码来源:SignPresenter.php

示例4: createComponentTagForm

 protected function createComponentTagForm()
 {
     $form = new Form();
     $form->addText('title', 'title:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('slug', 'slug:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('color', 'color:')->setRequired()->getControlPrototype()->addClass('color {minV:0.9} form-control');
     $form->addText('bg_color', 'bg_color:')->setRequired()->getControlPrototype()->addClass('color {maxV:0.5} form-control');
     $form->addCheckbox('active', 'active:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addSubmit('send', 'Save tag')->getControlPrototype()->setName('button')->addClass('btn btn-success')->setHtml('<span class="glyphicon glyphicon-ok"></span>');
     $form->onSuccess[] = array($this, 'tagFormSucceeded');
     // 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-10';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 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');
     // <form class="form-horizontal">
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
开发者ID:pw-press,项目名称:web-project,代码行数:34,代码来源:TagPresenter.php

示例5: createComponentContactForm

 /**
  * Contact form
  */
 protected function createComponentContactForm()
 {
     // vytvoříme element
     $products = array('Zakladni' => 'Základní', 'Pokrocile' => 'Pokročilé', 'NaMiru' => 'Na Míru', 'Ostatni' => 'Ostatní');
     $form = new Form();
     $form->addText('name', 'Jméno ')->addRule(Form::FILLED, 'Zadejte jméno');
     $form->addSelect('product', 'Produkt:', $products)->setRequired()->setDefaultValue('Zakladni');
     $form->addText('phone', 'Telefon ');
     $form->addText('email', 'Email')->addRule(Form::FILLED, 'Zadejte email')->addRule(Form::EMAIL, 'Email nemá správný formát');
     $form->addTextarea('message', 'Zpráva', 999, 5)->addRule(Form::FILLED, 'Zadejte zprávu');
     $form->addSubmit('send', 'Odeslat');
     // 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-12';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-12  text-center"';
     $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-green btn-block btn-lg' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = $this->processContactForm;
     return $form;
 }
开发者ID:pzdesign,项目名称:patrik-zizka-nette,代码行数:38,代码来源:HomepagePresenter.php

示例6: create

 /**
  * @return Form
  */
 public function create($role)
 {
     $rights = $this->database->table('rights')->fetchPairs('id', 'name');
     $form = new Form();
     $form->addHidden('id');
     $form->addText('username', 'uživatelské jméno: ')->addRule(Form::FILLED, 'Zadejte prosím jméno.');
     $form->addText('email', 'email: ')->addRule(Form::FILLED, 'Zadejte prosím email.')->addRule(Form::EMAIL, 'Email by měl mít platný formát');
     if (in_array("admin", $role)) {
         // editace prav jen adminem
         $form->addSelect('rights_id', 'level práv: ', $rights);
     }
     $form->addSubmit('submit', 'uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     //bootstrap vzhled
     $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'] = '';
     $renderer->wrappers['label']['container'] = 'div class="control-label col-sm-5"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
开发者ID:JakubMarden,项目名称:bazenycz,代码行数:28,代码来源:userEditFormFactory.php

示例7: setFilterForm

 public function setFilterForm(Form $filter_form, $template = NULL)
 {
     if (!isset($filter_form['reset']) || !isset($filter_form['filter'])) {
         throw new Grid_Exception('Filter form component have required submit buttons with names "reset" and "filter".');
     }
     if (!$filter_form['reset'] instanceof SubmitButton || !$filter_form['filter'] instanceof SubmitButton) {
         throw new Grid_Exception('Filter form\'s components "reset" and "filter" must be instanceof \\Nette\\Forms\\Controls\\SubmitButton.');
     }
     if (is_null($template) && $filter_form->getRenderer() instanceof DefaultFormRenderer) {
         $filter_form->setRenderer(new FilterFormRenderer());
     }
     $filter_form->getElementPrototype()->class('form-inline', TRUE)->role('form')->action($this->link('submitForm!'));
     $this->filter_form = $filter_form;
     $this->form_template = $template;
 }
开发者ID:Aearsis,项目名称:DataGrid,代码行数:15,代码来源:Filter.php

示例8: createComponentKomentarForm

 /**
  * Formular pre pridanie komentara.
  * @return Nette\Application\UI\Form
  */
 protected function createComponentKomentarForm()
 {
     $form = new Nette\Application\UI\Form();
     $form->addHidden('id_oznam', $this->id_oznam);
     $form->addHidden('id_user_profiles', $this->id_user_profiles);
     $form->addTextArea('text')->setAttribute('class', 'form-control')->setAttribute('rows', $this->textA_rows);
     //->setDefaultValue('');
     $form->addSubmit('uloz', 'Pridaj komentár')->setAttribute('class', 'btn btn-success');
     $form->onSuccess[] = $this->onZapisKomentar;
     $form->getElementPrototype()->class('ajax');
     $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-12';
     $renderer->wrappers['label']['container'] = 'div style="display:none"';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     return $form;
 }
开发者ID:petak23,项目名称:scspp,代码行数:23,代码来源:Komentar.php

示例9: bootstrapForm

 /**
  * Bootstrap 3 Forms
  *
  * Setting HTML for forms with Bootstrap 3 syntax
  *
  * @return Nette\Application\UI\For
  */
 protected function bootstrapForm()
 {
     $form = new Form();
     $renderer = $form->getRenderer();
     // dump($renderer->wrappers);
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = NULL;
     $renderer->wrappers['label']['container'] = NULL;
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $renderer->wrappers['control']['.text'] = $renderer->wrappers['control']['.password'] = $renderer->wrappers['control']['.select'] = 'form-control';
     $renderer->wrappers['label']['requiredsuffix'] = " *";
     $renderer->wrappers['error']['container'] = NULL;
     $renderer->wrappers['error']['item'] = "div class='alert alert-danger'";
     $renderer->wrappers['control']['.submit'] = $renderer->wrappers['control']['.button'] = 'btn btn-primary';
     return $form;
 }
开发者ID:rotten77,项目名称:asdf,代码行数:26,代码来源:BasePresenter.php

示例10: create

 /**
  * @return Form
  */
 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->enctype = 'multipart/form-data';
     $form->addHidden('galeries_id');
     $form->addUpload('files', '', true)->setAttribute('id', "files")->setAttribute('class', "btn btn-primary");
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->addSubmit('submit', 'uložit')->setAttribute('class', "btn btn-primary btn-md")->setAttribute('id', "submit_files");
     //bootstrap vzhled
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = 'well well-sm';
     $renderer->wrappers['pair']['container'] = '';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = '';
     $renderer->wrappers['label']['container'] = 'div class=custom-label';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
开发者ID:JakubMarden,项目名称:bazenycz,代码行数:23,代码来源:GalleryDetailFormFactory.php

示例11: activateBootstrapRenderer

 public function activateBootstrapRenderer(Nette\Application\UI\Form $form)
 {
     $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-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
 }
开发者ID:RiKap,项目名称:ErrorMonitoring,代码行数:23,代码来源:BaseFormFactory.php

示例12: create

 /**
  * @return Form
  */
 public function create()
 {
     $boolean = array(0 => 'ne', 1 => 'ano');
     $form = new Form();
     $form->addHidden('id');
     $form->addDatePicker('date', 'datum: ')->setAttribute('class', 'datepicker');
     $form->addText('name', 'nadpis: ', 100)->addRule(Form::FILLED, 'Zadejte prosím nadpis.');
     $form->addTextArea('description', 'krátký popis: ', 105);
     $form->addSelect('active', 'zobrazit: ', $boolean)->setDefaultValue(1);
     $form->addSubmit('submit', 'uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     //bootstrap vzhled
     $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'] = '';
     $renderer->wrappers['label']['container'] = 'div class=custom-label';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
开发者ID:JakubMarden,项目名称:bazenycz,代码行数:26,代码来源:GalleryEditFormFactory.php

示例13: makeBootstrap

 /**
  * @param Form $form
  * @return Form
  */
 public static function makeBootstrap(Form $form)
 {
     $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';
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Button) {
             $control->setAttribute('class', empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = true;
         } elseif ($control instanceof TextBase || $control instanceof SelectBox || $control instanceof MultiSelectBox) {
             $control->setAttribute('class', 'form-control');
         } elseif ($control instanceof Checkbox || $control instanceof CheckboxList || $control instanceof RadioList) {
             $control->getSeparatorPrototype()->setName('div')->class($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
开发者ID:vitush93,项目名称:kryo,代码行数:27,代码来源:BootstrapForm.php

示例14: createComponentPostForm

 protected function createComponentPostForm()
 {
     $form = new Form();
     $form->addText('title', 'Titulek:')->setRequired();
     $form->addTextArea('content', 'Obsah:', 55, 8)->setRequired()->setAttribute('class', 'mceEditor');
     $form->getElementPrototype()->onsubmit('tinyMCE.triggerSave()');
     $form->addSubmit('send', 'Vložit článek');
     foreach ($form->getComponents(TRUE, 'SubmitButton') as $button) {
         if (!$button->getValidationScope()) {
             continue;
         }
         $button->getControlPrototype()->onclick('tinyMCE.triggerSave()');
     }
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class="form-group text-center"';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class="col-sm-10"';
     $renderer->wrappers['label']['container'] = 'div class="control-label text-center col-sm-1"';
     $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-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = array($this, 'postFormSucceeded');
     return $form;
 }
开发者ID:pzdesign,项目名称:statekbenatky-nette,代码行数:37,代码来源:StrankyPresenter.php

示例15: create

 /** @return Form */
 public function create()
 {
     $f = new Form();
     $f->addText('name', 'Jméno:');
     //->setRequired();
     $f->addText('surname', 'Příjmení:');
     //->setRequired();
     $f->addText('institution', 'Pracoviště:');
     $f->addText('project', 'Projekt:');
     $f->AddText('www', 'web:');
     $f->addText('date', 'Datum setkání:')->setAttribute('placeholder', 'rrrr-mm-dd');
     $f->addTextArea('note', 'Poznámka')->setAttribute('rows', '10');
     $f->addMultiUpload('img', 'Vizitka');
     $f->addUpload('foto', 'Foto:');
     $f->addSubmit('submit', 'Uložit');
     // setup form rendering
     $renderer = $f->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-8';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $f->getElementPrototype()->class('form-horizontal');
     foreach ($f->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-success' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $f;
 }
开发者ID:vol0054,项目名称:vizitky,代码行数:38,代码来源:CardFormFactory.php


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