Problem/Motivation
Attempting to edit a chart field with its widget set to NOT allow users to change charting library results in the following error:
The website encountered an unexpected error. Try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\charts\ChartManager are: highcharts in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition(NULL) (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance(NULL, Array) (Line: 83)
Drupal\Component\Plugin\PluginManagerBase->createInstance(NULL, Array) (Line: 854)
Drupal\charts\Element\BaseSettings::addLibraryElementOptions(Array, Object, Array) (Line: 202)
Drupal\charts\Element\BaseSettings::processSettings(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 1011)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1074)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1074)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1074)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1074)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 154)
Drupal\autosave_form\Form\AutosaveFormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 263)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 130)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
- Having a field called "My Chart"
- In the "Manage Form Display" section, use the Chart widget to (uncheck) not "allow users to change the default charting library"
- Go back to the "Manage Fields" section, and edit the field again.
- The option "Charting Library" is not present in the field configuration and cannot be changed.
- Attempting to make any changes result in the error copied above.
This appears to happen regardless of the value set in the field. I have re-enabled the field a few times to try different combinations with no luck. Some tests (in code) got me as far as getting it to detect the "site_default" only to then encountered another error where the value was not recognized so this may be a bigger issue.
Proposed resolution
The "Charting Library" option should always be available in the settings of the field, whether the widget was set to hide it or not. This allows admins to change the default charting library if needed and prevent the error reported.
Remaining tasks
User interface changes
API changes
Data model changes
----
This appears related but I've already tested 5.1.x-dev with no success:
https://www.drupal.org/project/charts/issues/3461914
π
Undefined array key ""
Active