本文整理汇总了PHP中Nette\Application\UI\Form::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getComponent方法的具体用法?PHP Form::getComponent怎么用?PHP Form::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::getComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComponent
public function getComponent($name, $need = TRUE)
{
if (isset($this->dict[$name])) {
$name = $this->dict[$name];
}
return parent::getComponent($name, $need);
}
示例2: formSucceed
public function formSucceed(Form $form, $values)
{
$filter = [];
foreach ($form->getComponent('filter')->getControls() as $component) {
if ($component->name == 'limit') {
if ($values->filter->limit != 50) {
$filter['limit'] = $values->filter->limit;
}
} elseif (!$component instanceof SubmitButton) {
if (!empty($values->filter->{$component->name})) {
$filter[$component->name] = $values->filter->{$component->name};
}
}
}
if (!empty($filter)) {
$this->filter = serialize($filter);
} else {
$this->filter = null;
}
$this->redirect('this');
}
示例3: colorSelectFormSubmitted
/**
* @param Form $form
*/
public function colorSelectFormSubmitted(Form $form)
{
$values = $form->getValues();
$subquestion = $this->subquestion_service->saveBaseProperties($values);
// rekonstrukce puvodnich id_pages
$id_page = $this->question_service->get($subquestion->id_question)->id_page;
$options = array();
if ($subquestion->id_page_related !== null) {
$related = $this->page_service->getRelatedPagesByFilter(new PageRelated(array(PageRelated::IDS_PAGE_RELATED => array($subquestion->id_page_related), \App\Base\Filter::GROUP_BY => true)));
if (count($related) === 1 && $related[0] !== null) {
$pages = $related[0]->getPagesRelatedAsArray();
$options = array($pages[0]->getPage()->id_page => "", $pages[1]->getPage()->id_page => "");
}
}
// $pages = $this->page_service->getRelatedPages($id_page);
// $options = array($id_page=>"",$pages[0]->id_page);
$form->getComponent("id_pages")->setItems($options);
$values = $form->getValues();
$subquestion->state = $values->id_pages === (int) $id_page ? \App\Model\Subquestion::STATE_CORRECT : \App\Model\Subquestion::STATE_WRONG;
$subquestion->answer = $values->id_pages;
$this->subquestion_service->save($subquestion);
if ($form['cancel']->isSubmittedBy()) {
$this->redirect("Survey:final");
}
if ($this->sessionSection->id_respondent === null) {
$this->sessionSection->id_question = $subquestion->id_question;
$this->redirect("Survey:personal");
} else {
$this->redirect("Survey:question");
}
}