Unverified Commit 2178a984 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3239558 by andypost: Properly use state counter in...

Issue #3239558 by andypost: Properly use state counter in \Drupal\search_embedded_form\Form\SearchEmbeddedForm
parent 9f574ee7
Loading
Loading
Loading
Loading
+2 −2
Changes for core/modules/search/tests/modules/search_embedded_form/src/Form/SearchEmbeddedForm.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ public function getFormId() {
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $count = \Drupal::state()->get('search_embedded_form.submit_count');
    $count = \Drupal::state()->get('search_embedded_form.submit_count', 0);

    $form['name'] = [
      '#type' => 'textfield',
@@ -48,7 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $state = \Drupal::state();
    $submit_count = (int) $state->get('search_embedded_form.submit_count');
    $submit_count = $state->get('search_embedded_form.submit_count', 0);
    $state->set('search_embedded_form.submit_count', $submit_count + 1);
    $this->messenger()->addStatus($this->t('Test form was submitted'));
  }