本文整理汇总了PHP中Venne\Forms\Form::hasSaveButton方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::hasSaveButton方法的具体用法?PHP Form::hasSaveButton怎么用?PHP Form::hasSaveButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::hasSaveButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleSave
public function handleSave(Form $form)
{
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
try {
$this->mapper->entityManager->getRepository(get_class($form->data))->save($form->data);
} catch (\Exception $e) {
$ok = true;
if (is_array($this->onCatchError) || $this->onCatchError instanceof \Traversable) {
foreach ($this->onCatchError as $handler) {
if (\Nette\Callback::create($handler)->invokeArgs(array($form, $e))) {
$ok = false;
break;
}
}
} elseif ($this->onCatchError !== NULL) {
$class = get_class($this);
throw new \Nette\UnexpectedValueException("Property {$class}::onCatchError must be array or NULL, " . gettype($this->onCatchError) . " given.");
}
if ($ok) {
throw $e;
}
}
}
}
示例2: actionFormSuccess
public function actionFormSuccess(VForm $form)
{
$this->invalidateControl('actionForm');
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
$this->id = NULL;
$this->formName = NULL;
if (!$this->presenter->isAjax()) {
$this->redirect('this', array('formName' => NULL, 'id' => NULL, 'mode' => NULL));
}
$this->invalidateControl('table');
if ($this->mode === $this::MODE_PLACE) {
$this->invalidateControl('navbarFormContainer');
$this->invalidateControl('actionFormContainer');
}
$this->presenter->payload->url = $this->link('this', array('formName' => NULL, 'id' => NULL, 'mode' => NULL));
}
}
示例3: formCreateSuccess
public function formCreateSuccess(\Venne\Forms\Form $form)
{
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
if (!$this->presenter->isAjax()) {
$this->redirect('create!', array('createForm' => NULL));
}
$this->getPresenter()->invalidateControl('content');
$this->presenter->payload->url = $this->link('create!', array('createForm' => NULL));
$this->createForm = NULL;
$this->handleCreate();
} else {
$this->invalidateControl('createForm');
}
}