Problem/Motivation

Many implementations of \Drupal\Core\Plugin\PluginFormInterface assume they are used as top-level forms because of the fact they call FormStateInterface::getValue() directly rather than getting the value from the form's state based on the plugin form's position in the parent form. This requires using NestedArray and $form['#parents'].

This works fine in core because most plugin forms are only used in one single way, but this obviously fails when embedding plugin forms in different parent forms. This is exactly what Plugin does.

Proposed resolution

Remaining tasks

Find all broken implementations and create separate issues for them.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

xano’s picture

Issue summary: View changes
xano’s picture

Issue summary: View changes
bojanz’s picture

I agree completely. The current situation is a hack that will only lead to further bugs.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

stone_d’s picture

I get this error :(

TypeError: Argument 1 passed to Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase::setContainedPluginConfiguration() must be of the type array, string given, called in /var/www/virtual/picstar_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php on line 202 in Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration() (line 108 of /var/www/virtual/picstar_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php) #0 /var/www/virtual/picstar_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php(202): Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration('a:5:{s:4:"name"...') #1 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/TypedData/TypedDataManager.php(195): Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setValue(Array, false) #2 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(82): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemList), 0, Array) #3 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Field/FieldItemList.php(40): Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object(Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemList), 0, Array) #4 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php(66): Drupal\Core\Field\FieldItemList->createItem(0, Array) #5 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Field/FieldItemList.php(118): Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, false) #6 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/TypedData/TypedDataManager.php(106): Drupal\Core\Field\FieldItemList->setValue(Array, false) #7 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1572): Drupal\Core\TypedData\TypedDataManager->create(Object(Drupal\field\Entity\FieldConfig), Array, 'field_payment_l...', Object(Drupal\Core\Entity\Plugin\DataType\EntityAdapter)) #8 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(175): Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object(Drupal\field\Entity\FieldConfig), 50) #9 /var/www/virtual/picstar_dp/core/modules/field/field.purge.inc(96): Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object(Drupal\field\Entity\FieldConfig), 50) #10 /var/www/virtual/picstar_dp/core/modules/field/field.module(167): field_purge_batch(50) #11 [internal function]: field_cron() #12 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Extension/ModuleHandler.php(391): call_user_func_array('field_cron', Array) #13 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Cron.php(223): Drupal\Core\Extension\ModuleHandler->invoke('field', 'cron') #14 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/Cron.php(122): Drupal\Core\Cron->invokeCronHandlers() #15 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run() #16 /var/www/virtual/picstar_dp/core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php(65): Drupal\Core\ProxyClass\Cron->run() #17 /var/www/virtual/picstar_dp/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate(Object(Symfony\Component\HttpKernel\Event\PostResponseEvent), 'kernel.terminat...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #18 /var/www/virtual/picstar_dp/vendor/symfony/http-kernel/HttpKernel.php(84): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.terminat...', Object(Symfony\Component\HttpKernel\Event\PostResponseEvent)) #19 /var/www/virtual/picstar_dp/vendor/stack/builder/src/Stack/StackedHttpKernel.php(32): Symfony\Component\HttpKernel\HttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #20 /var/www/virtual/picstar_dp/core/lib/Drupal/Core/DrupalKernel.php(634): Stack\StackedHttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #21 /var/www/virtual/picstar_dp/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #22 {main}.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Version: 9.2.x-dev » 9.4.x-dev

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Category: Bug report » Plan
Status: Active » Fixed
Issue tags: +Bug Smash Initiative

There is one issue child left in this Meta. We have a practice of allowing metas to be closed when there is only one remaining item. I am doing that now.

This is also not a bug report, I am changing it to a plan.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.