Support chart_config field

Created on 24 April 2024, 2 months ago
Updated 25 April 2024, 2 months ago

Is it possible to support the chart_config field type defined by charts module?
https://www.drupal.org/project/charts →

The module is used by around 18k users.

I tried to simply add it to /modules/contrib/single_content_sync/src/Plugin/Derivative/SingleContentSyncFieldProcessor/SimpleFieldDeriver.php

Which does not work. I thought it could be that easy as the "link" field seems to be similar. But trying to open export dialog for content with a chart_config field attached results in:

Drupal\Component\Serialization\Exception\InvalidDataTypeException: Object support when dumping a YAML file has been disabled. in Drupal\Component\Serialization\YamlSymfony::encode() (Zeile 25 in /core/lib/Drupal/Component/Serialization/YamlSymfony.php).

My charts field has the name field_diagramm - in the field table I find the following definition:

Spaltenname	#	Datentyp	Identität	Kollation	Nicht Null	Standard	Kommentar
bundle	1	varchar(128)	[NULL]	default	true	''::character varying	The field instance bundle to which this row belongs, used when deleting a field instance
deleted	2	int2	[NULL]	[NULL]	true	0	A boolean indicating whether this data item has been deleted
entity_id	3	int8	[NULL]	[NULL]	true	[NULL]	The entity id this data is attached to
revision_id	4	int8	[NULL]	[NULL]	true	[NULL]	The entity revision id this data is attached to
langcode	5	varchar(32)	[NULL]	default	true	''::character varying	The language code for this data item.
delta	6	int8	[NULL]	[NULL]	true	[NULL]	The sequence number for this data item, used for multi-value fields
field_diagramm_config	7	bytea	[NULL]	[NULL]	true	[NULL]	[NULL]
field_diagramm_library	8	varchar(255)	[NULL]	default	false	[NULL]	The chart library.
field_diagramm_type	9	varchar(255)	[NULL]	default	false	[NULL]	The chart type.

field_diagramm_config: contains the charts data as serialised information (e.g. "a:8:{s:7:"library";s:10:"highcharts";s:4:"type";s:3:"bar";s:13:"use_drilldown";s:1:"1";s:6:"series";a:2:{s:27:"table_categories_identifier";s:12:"first_column";s:20: ...."
field_digramm_library: contans the name of the charts library used (e.g. google_charts, highcharts, ...)
field_diagramm_type: name of the bar type in use (e.g. bar, line, bubble)

Can anyone help? Or, is the a similar field type already implemented I can use as a template?

✨ Feature request
Status

Active

Version

1.4

Component

Code

Created by

🇩🇪Germany vistree

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

Merge Requests

Comments & Activities

  • Issue created by @vistree
  • 🇩🇪Germany vistree
  • 🇩🇪Germany vistree

    After some debugging I found out that the error is not related to the single_content_sync module - instead it had to do with the charts structure. I fixed that and now I can export the chart_config by just adding the field name to

    /modules/contrib/single_content_sync/src/Plugin/Derivative/SingleContentSyncFieldProcessor/SimpleFieldDeriver.php

  • Merge request !104add charts_config field → (Open) created by vistree
  • Pipeline finished with Failed
    2 months ago
    Total: 192s
    #156131
Production build 0.69.0 2024