Problem/Motivation

If you have more than one feedback type, and you change the Feedback type select list on a block form, the value is saved but the select list does not show it.

Steps to reproduce

  1. Set up a local 3.x environment
  2. Log in as an administrator
  3. Go to /admin/structure/feedback_message_type/add, and add a new feedback type with the Label and Machine name = zzz_feedback. Don't add any fields.
  4. Go to /admin/structure/block/add/feedback_block/olivero?region=sidebar_second. Set the Title and Machine name = test. Set Feedback type = zzz_feedback. Click the Save block button.
  5. Go to the front page of your site and observe the feedback block has no "Body" field.
  6. Go to /admin/structure/block/manage/test.
    Expected behavior: Feedback type = zzz_feedback.
    Actual behavior: Feedback type = Default feedback.

Proposed resolution

Fix the spelling mistake in the block form...

diff --git a/src/Plugin/Block/FeedbackBlock.php b/src/Plugin/Block/FeedbackBlock.php
index b45e2bc..0bc7efe 100644
--- a/src/Plugin/Block/FeedbackBlock.php
+++ b/src/Plugin/Block/FeedbackBlock.php
@@ -109,7 +109,7 @@ public function blockForm($form, FormStateInterface $form_state) {
       '#type' => 'select',
       '#title' => $this->t('Feedback type'),
       '#options' => $feedback_types,
-      '#default_option' => $type,
+      '#default_value' => $type,
       '#description' => $this->t('Select the feedback type which will be used.'),
     ];
 

Remaining tasks

  1. Merge request - merge request !13 created by @mparker17 in #2
  2. Community review - skipped by @mparker17 in #3
  3. Maintainer review - skipped by @mparker17 in #3
  4. Commit - merged by @mparker17 in #4
  5. Release

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork feedback-3588194

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community

Tests pass. Going to skip the reviews because this was written by a maintainer.

  • mparker17 committed c702a5b0 on 3.x
    fix: #3588194 Feedback type does not show selected option on block form...
mparker17’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Great. I'll update this issue when this code is released.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.