Adding additional custom fields ...

Created on 2 October 2023, 12 months ago
Updated 4 October 2023, 12 months ago

Problem/Motivation

This module has been super helpful - I just got done wiring up to an external service that requires authentication, I'm able to search, return results, and select a result for embed. I've created fields and mapped them to the 6 mappable data values (Url, thumbnail, description, alt, photographer, photographer_url), that all seems to be working, the values do write to the fields.

The question here is: Is there a recommended way of adding additional fields/data points to be able to map to? My data source is a rather complex dataset with DOZENS of data points, way more than the 6 (or 7 if you include ID field) available, and I'd like to be able to specify the additional data to be mapped to fields created on the Media entity. Suggestions??

Steps to reproduce

Create plugin to use external data source/API - choose only 6 data points of dozens that are available from your data source - left wanting to pass more values to fields on the Media type.

Proposed resolution

Seems like there are three possible solutions to this? I'm not sure how to accomplish any of them off the top of my head:

  1. Can the module be extended to allow more data points to be passed through to the Media entity type that we created? If so, seems like there would need to be a way for the module to now to create additional field mapping options.
  2. Maybe there could be a way to specify the additional mappings in code (via plugin?) to allow more flexibility/extensibility of the field mappings?
  3. Maybe the field mappings don't need to be named (like they're currently called photographer, photographer url, etc) and could be more generic (like data 1, data 2, data 3, etc), and either have a bunch more of them, or the ability to "add another"? In my case, some of our external assets are photographs (of photographs), and others are images of sculptures and paintings, etc, so we actually would need "artist" not "photographer". Point is - I don't care about the field names (and I don't think other people need to care either), just having the data points be named generically and then being able to map them to named field would be enough to identify the purposes of each data point, and that change might make it easier to enable the ability to have many more or unlimited number of data points passed through?

Summary

I'm just looking for a way to pass more data points from our external API call and map them to the Media Type Drupal fields. Not sure how to best go about this. If there is a suggestion on how I can extend the module in my own scenario to make it work, that would be amazing. Otherwise, these ideas might make for good improvements to the module.

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States brobert7

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

Comments & Activities

Production build 0.71.5 2024