It causes the following PHP notice:

Notice: Undefined index: items_count in Drupal\Core\Field\WidgetBase::addMoreSubmit() (line 310 of /var/www/html/core/lib/Drupal/Core/Field/WidgetBase.php)

PrivateMessageForm::buildForm constructs the form display of the private message thread to get the members widget from it.
However it uses clone of the formState object, so the WidgetBase::form can't populate the original form state object with the field widget data.

We can pass the original formstate object or try to fill the storage data manually. I don't like any of it

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

artem_sylchuk created an issue. See original summary.

  • artem_sylchuk committed 8000f78 on 8.x-2.x
    Issue #3203419 by artem_sylchuk: Private Message formState storage isn't...
artem_sylchuk’s picture

artem_sylchuk’s picture

Status: Fixed » Closed (fixed)
bohart’s picture

Version: 8.x-2.x-dev » 3.0.x-dev
Status: Closed (fixed) » Needs work
Issue tags: +LutskGCW24

Hi @artem_sylchuk,
Something went wrong on this issue.

The commit added this line:
if (empty($storage['field_storage']['#parents']['#fields']['members'])) {

But variable $storage is always empty (as it is never defined).
Should we move `$storage = $form_state_copy->getStorage();` above the if or completely remove those lines?

Thanks!