Integration with yearonly

Created on 27 January 2023, almost 2 years ago
Updated 29 January 2023, almost 2 years ago

Problem/Motivation

custom field type yearonly defined by the contrib module " Year Only β†’ " is not supported

Steps to reproduce

create a content with yearonly field value
export that content
get the message about non-supported field types and the value is not exported in the .yml

Proposed resolution

As the value handled by that field is pretty straightforward, only 1 line need to be updated in ContentExporter.php file. (patch to come)
I also add an example of using the right hook for that field type if this can help

/**
 * Implements hook_content_export_field_value_alter().
 */
MODULE_content_export_field_value_alter(&$value, FieldItemListInterface $field) {
  $field_definition = $field->getFieldDefinition();
  $field_type = $field_definition->getType();
  if ($field_type == 'yearonly') {
    $value = $field->getValue();
  }
}
✨ Feature request
Status

Fixed

Version

1.3

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium stred

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

Comments & Activities

Production build 0.71.5 2024