/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $condition_id = NULL, $contexts = []) { $this->condition = $this->prepareCondition($condition_id); $temporary = $form_state->getTemporary(); $temporary['gathered_contexts'] = $contexts; $form_state->setTemporary($temporary); // Allow the condition to add to the form. $form['condition'] = $this->condition->buildConfigurationForm([], $form_state); $form['condition']['#tree'] = TRUE; $form['actions'] = ['#type' => 'actions']; $form['actions']['submit'] = ['#type' => 'submit', '#value' => $this->submitButtonText(), '#button_type' => 'primary']; return $form; }
/** * {@inheritdoc} */ public function getTemporary() { return $this->mainFormState->getTemporary(); }
/** * {@inheritdoc} */ public function getTemporary() { return $this->decoratedFormState->getTemporary(); }
/** * @covers ::getTemporary */ public function testGetTemporary() { $temporary = ['FOO' => 'BAR']; $this->decoratedFormState->getTemporary()->willReturn($temporary)->shouldBeCalled(); $this->assertSame($temporary, $this->formStateDecoratorBase->getTemporary()); }