why does EntityForm::copyFormValuesToEntity() specifically not copy form values for a plugin collection?

Created on 31 May 2017, almost 8 years ago
Updated 6 September 2024, 8 months ago

I have a config entity type, which works with a single plugin, and thus uses DefaultSingleLazyPluginCollection.

The entity form for this gets form elements from the selected plugin, and then the form values should get saved into the entity.

However, copyFormValuesToEntity specifically stops this from happening:

  protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
    $values = $form_state->getValues();

    if ($this->entity instanceof EntityWithPluginCollectionInterface) {
      // Do not manually update values represented by plugin collections.
      $values = array_diff_key($values, $this->entity->getPluginCollections());
    }

The keys of getPluginCollections() are the entity properties that store plugin configuration.

Am I doing something wrong in the way I am building a config entity + plugin combination?

πŸ’¬ Support request
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
PluginΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024