Call to undefined function _color_unpack()

Created on 17 July 2023, 12 months ago
Updated 26 July 2023, 11 months ago

Problem/Motivation

For some unknown reason, it throws PHP error Call to undefined function Drupal\signature_field\Plugin\Field\FieldWidget\_color_unpack() in Drupal\signature_field\Plugin\Field\FieldWidget\SignatureWidget->formElement() (line 220 of /modules/contrib/signature_field/src/Plugin/Field/FieldWidget/SignatureWidget.php). Upon checking on the core's color.module file, I can confirm that the _color_unpack() function exists.

It works fine if you don't make any changes to the widget settings. However, the page breaks and shows an error when I try to change the background and pen color.

Currently, I'm using Drupal core version 9.5.x and signature_field version 3.x.

Steps to reproduce

1) Add signature field.
2) Configure field widget settings.
3) Save.
4) View the form.

Proposed resolution

This module requires the color module from the core, but it is an outdated extension in Drupal 10. It was introduced in version 9.4.x. Instead, there is a backported version of the color module already available at at https://www.drupal.org/project/color .

I have two potential solutions to resolve the issue:

1) For Drupal 10 version, change the dependency to from "drupal:color" to "color:color" and add a composer.json file to include the color as package dependency.
2) For Drupal 9 to latest version, replicate the _color_unpack() function code and create _signature_field_color_unpack() function.

I haven't thoroughly examined the codebase of this module, so solution #2 might not be an option.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇵🇭Philippines madelyncruz

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

Comments & Activities

Production build 0.69.0 2024