0

I created a new entity and added a few base fields using baseFieldDefinitions(). Everything works fine so far. The problem is that I would like on this entity to have a field with special storage ( outside of what baseFieldDefinitions() seems to be able to handle ). I want this new field to use the 'point' spatial data type.

Is this possible? If so, it is done via the Typed Data API?

I know that this is vague but I'm trying to get a grasp on these concepts and any pointers will be greatly appreciated.

2
  • 1
    Not enough detail to say for sure, but it's possible you can create a new field type, which lets you someone set the storage details, that you could then set as the type for your BaseFieldDefinition. Though you'd have to swap out the back-end storage if you wanted to change that futher. – Jaypan Mar 6 '20 at 16:29
  • 1
    It should be possible... you can certainly create your own FieldType. Check the docs on mysql_type or your database you are using for supported record types. api.drupal.org/api/drupal/… - note that you might have to do special handling for say, Views fields and filters, as well as provide a FieldFormatter and FieldWidget to display and capture form data. – Kevin Mar 7 '20 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.