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


PHP Form::getComponents方法代码示例

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


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

示例1: setEntityToForm

 /**
  * @param BaseEntity $entity
  * @param Form $form
  */
 public function setEntityToForm(BaseEntity &$entity, Form &$form)
 {
     /** @var BaseControl $control */
     foreach ($form->getComponents() as $control) {
         /** @noinspection PhpParamsInspection */
         $value = $this->getEntityValue($entity, $control);
         if (!$value) {
             continue;
         }
         // do base
         $this->mapValueToForm($value, $control);
     }
 }
开发者ID:pecinaon,项目名称:sandbox,代码行数:17,代码来源:FormEntityMapper.php

示例2: 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


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