本文整理汇总了PHP中Drupal\Core\Form\FormStateInterface::setProgrammed方法的典型用法代码示例。如果您正苦于以下问题:PHP FormStateInterface::setProgrammed方法的具体用法?PHP FormStateInterface::setProgrammed怎么用?PHP FormStateInterface::setProgrammed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Form\FormStateInterface
的用法示例。
在下文中一共展示了FormStateInterface::setProgrammed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProgrammed
/**
* {@inheritdoc}
*/
public function setProgrammed($programmed = TRUE)
{
$this->mainFormState->setProgrammed($programmed);
return $this;
}
示例2: submitForm
/**
* {@inheritdoc}
*/
public function submitForm($form_arg, FormStateInterface &$form_state)
{
$build_info = $form_state->getBuildInfo();
if (empty($build_info['args'])) {
$args = func_get_args();
// Remove $form and $form_state from the arguments.
unset($args[0], $args[1]);
$form_state->addBuildInfo('args', array_values($args));
}
// Populate FormState::$input with the submitted values before retrieving
// the form, to be consistent with what self::buildForm() does for
// non-programmatic submissions (form builder functions may expect it to be
// there).
$form_state->setUserInput($form_state->getValues());
$form_state->setProgrammed();
$form_id = $this->getFormId($form_arg, $form_state);
$form = $this->retrieveForm($form_id, $form_state);
// Programmed forms are always submitted.
$form_state->setSubmitted();
// Reset form validation.
$form_state->setValidationEnforced();
$form_state->clearErrors();
$this->prepareForm($form_id, $form, $form_state);
$this->processForm($form_id, $form, $form_state);
}
示例3: testSetProgrammed
/**
* @covers ::setProgrammed
*
* @dataProvider providerSingleBooleanArgument
*
* @param bool $programmed
*/
public function testSetProgrammed($programmed)
{
$this->decoratedFormState->setProgrammed($programmed)->shouldBecalled();
$this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setProgrammed($programmed));
}