/** * {@inheritdoc} */ public function setProgrammed($programmed = TRUE) { $this->mainFormState->setProgrammed($programmed); return $this; }
/** * {@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); }
/** * @covers ::setProgrammed * * @dataProvider providerSingleBooleanArgument * * @param bool $programmed */ public function testSetProgrammed($programmed) { $this->decoratedFormState->setProgrammed($programmed)->shouldBecalled(); $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setProgrammed($programmed)); }