JsonEditorWidget no longer works without tweaks

Created on 5 January 2023, over 1 year ago
Updated 24 July 2023, 11 months ago

Problem/Motivation

The JsonEditorWidget submodule does not work

Steps to reproduce

  1. Create a JSON raw field on a content type
  2. Navigate to the "Manage form display" tab of the content type and use the JSON-specific WYSIWYG editor on the JSON raw field
  3. Click "Save" and immediately get a warning (if display errors is on) about schema.json was not found. Warning: file_get_contents(.../docroot/modules/contrib/json_field/modules/json_field_widget/src/Plugin/Field/FieldWidget/../../../../assets/schema.json): Failed to open stream: No such file or directory in Drupal\json_field_widget\Plugin\Field\FieldWidget\JsonEditorWidget->settingsForm() (line 82 of /.../docroot/modules/contrib/json_field/modules/json_field_widget/src/Plugin/Field/FieldWidget/JsonEditorWidget.php)
  4. Add new content for the type where the json raw field was added
  5. The editor does not appear for the field

Proposed resolution

Several references to json_field need to be changed to json_field_widget:

  • In JsonEditorWidget file...
    • the library attachments should be json_field_widget/json_editor.widget
    • the schema file should either go to __DIR__ . '/../../../../../../assets/schema.json' OR the schema.json file should be moved to json_field_widget/assets
  • In json_field_widget.libraries.yml file, the dependency should be json_field_widget.jsoneditor

Patches coming

πŸ› Bug report
Status

Closed: duplicate

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States amaria

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.69.0 2024