This is follow-up of #1910626: Ubercart Addresses field handler API: Fields should specify their data type.

Problem/Motivation

Recently, Entity (API) integration was added to Ubercart Addresses (see #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. One metadata item is the data type of the field, simply called 'type'. This can be 'text', 'integer', 'boolean', etc.

Extra Fields Pane should specify the data types of each field. This can be done in the hook implementation of hook_uc_addresses_fields(), as Ubercart Addresses passes any info provided in that hook automatically to Entity API via an implementation of hook_entity_property_info().

Other info that is useful to specify, is the metadata item 'options list'. In Rules this is used in data comparisons to select the user from a list of options. This is useful for select fields.

Proposed resolution

Extend the contents in the function uc_extra_fields_pane_uc_addresses_fields() and specify the data type for each field type. For the checkbox field type this is boolean. The other fields are of type text (the default).
Also specify 'options list' for the select list field types ('Select list' and 'PHP select list').

Data types should be specified in both 6.x-2.x and 7.x-1.x. Specifying 'options list' should only happen in 7.x-1.x as it has no meaning in the 6.x-2.x version.

Remaining tasks

  • Specify field data types for the 6.x-2.x and 7.x-1.x version.
  • Define 'options list' for select list field types (7.x-1.x only).

User interface changes

None directly, but in Rules (Extra Fields Pane 7.x-1.x only), the user can select from a list of options for select field types in data comparisons.

API changes

No changes in the Extra Fields Pane API, but a change in the Ubercart Addresses API implementation.

A patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MegaChriz’s picture

Status: Active » Needs review
FileSize
2.15 KB

This patch specifies the data type for each field + it implements options list for select fields.

MegaChriz’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed #1.

Moving to 6.x-2.x.

MegaChriz’s picture

Status: Patch (to be ported) » Needs review
FileSize
660 bytes

Patch for the 6.x-2.x version. Looks similar to the implementation for the 7.x-1.x version except that 'options list' in the field definitions is not specified, because that only has relevance for Entity API (which doesn't exists for Drupal 6).

MegaChriz’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Fixed

Committed #3.

Setting issue back to the version it was originally reported for and mark it as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.