Incompatibility with Data field field type

Created on 17 April 2025, 7 days ago

Problem/Motivation

The module is incompatible with Data field .
When both modules are enabled, and upon visiting the settings form for Field Encryption, an error occurs due to the way the "Default properties" element is constructed.

\Drupal\field_encrypt\Form\SettingsForm::buildForm() calls BaseFieldDefinition::create($type) which in turn calls \Drupal\datafield\Plugin\Field\FieldType\DataFieldItem::propertyDefinitions().
DataFieldItem::propertyDefinitions() relies upon the "field_name" property being set in the definition array.

Steps to reproduce

  1. Install and enable both the Data field and Field Encryption modules
  2. Visit /admin/config/system/field-encrypt
  3. This results in a "Undefined array key "field_name""

Proposed resolution

I am not sure what the best way to deal with the problem would be. I don't know how much work would be needed to make Field Encryption work with the "data_field" field type, or if it would even be possible due to the dynamic nature of the properties on that field type.

Maybe add some "defensive code" to at least avoid this kind of error, and document this incompatibility somewhere ?

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇫🇷France arousseau

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

Comments & Activities

Production build 0.71.5 2024