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

Issue fork charts-3533497

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

cballenar created an issue. See original summary.

stefan.korn made their first commit to this issue’s fork.

stefan.korn’s picture

I am also experiencing this issue if the setting for "Allow users to change the default charting library" is unset.

It seems to me just changing the form element type from "value" to "hidden" in this case solves this issue (see MR).

But I a wondering whether this issue is newly arising, the underlying code for the setting does not have seem to have been changed recently and seems to be in place for quite a while.

stefan.korn’s picture

Status: Needs work » Needs review
cballenar’s picture

Thanks @stefan.korn ! That resolved the error on my end too.

It's worth mentioning that the 'Charting Library' field will continue to be hidden even in the field settings (Default Value). Requiring the widget to be checked, change the default, and then uncheck the widget again.

andileco made their first commit to this issue’s fork.

  • andileco committed 6d2ee3e4 on 5.1.x authored by stefan.korn
    Issue #3533497 by stefan.korn, cballenar: Field widget limits access to...
andileco’s picture

Status: Needs review » Fixed

Thank you! Committed.

Status: Fixed » Closed (fixed)

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