This a subissue of #1831424: Turn Ubercart Addresses address into an entity.
The Entity API module provides a hook called
hook_entity_property_info() with which metadata about entity properties can be defined. Ubercart Addresses provides the hook
hook_uc_addresses_fields() with which address fields can be registered. As each address field of an address is essentially a property of the upcoming address entity, it would be nice if property metadata can be defined in
hook_uc_addresses_fields(), so modules that register address fields don't need to implement
hook_entity_property_info() as well to define additional or similar information about their fields.
One metadata item is the data type of the field, simply called 'type'. This can be 'text', 'integer', 'boolean', etc. So, in preparation of the entity integration, it would be nice if the data type is declared for each field, which will fallback to 'text' for if it's not defined.
Though it would only have a function for the 7.x-1.x version, fields specifying their data types will also be implemented for the 6.x-2.x version for consistency (and the information *could* be useful for modules extending Ubercart Addresses as well).
The Ubercart Addresses Example module already used the 'type' property to define the database data type. The example module should be adjusted to remain compatible with future changes (Entity API integration).
Current registered address fields will get an extra property called 'type'. This will be mapped to Entity API property info later on. Optionally, other properties could be defined as documented by
- Define data types for each registered address field that should not be just text.
- Provide the default value 'text' for property 'type' in
Adjust Ubercart Addresses Example module.Fixed in #1911136: Ubercart Addresses Example module: separate schema definitions from field handler API definitions.
User interface changes
Modules registering address fields should from now on define the data type of their fields if it's not supposed to be just text. Optionally, they can define other properties as documented by
I'm working on it.