Fieldable Fields

Categories

Component ID

1565582

Component name

Fieldable Fields

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body


Fieldable Fields

As of Drupal 7, the Field API and the Entity concepts open up a world of possibilities for detailed, bespoke cms design.

Almost all the "atomic" components are now implemented as Fieldable EntityTypes:

  • Node
  • Comment
  • Taxonomy Vocabulary
  • Taxonomy Term
  • User
  • OpenGroups Group
  • DeveloperDefined EntityTypes
  • more...

Each Field itself may have a variety of settings associated with it. These settings are specified using the FAPI and the resulting dict automatically serialised and stored. There are two types of settings: Field Settings, which are settings that apply globally to that Field; Field Instance Settings, which are specific to each FieldInstance (A FieldInstance is created when a Field is added to a Bundle)

It can become a little knotty understanding the terms involved in the Drupal EntityType/Bundle/Field/FieldInstance/Entity ecology. [IS THERE A LINK TO A GOOD PAGE TO PUT HERE?]

Currently the fields for the Field Settings and Field Instance Settings have to be coded by hand, using the FormsAPI. There is currently no way to use Fields which have (already) been created using the FieldAPI as settings for Fields. Having to hand code all the fields for Field Settings and FieldInstance Settings doesn't sit right given the design goals of the FIeld API

The intent of this module is to allow Fields defined in hook_field_info to be used as fields for Field Settings and FieldInstance Settings.

Difference between Fieldable Fields and Field Collection

If you are looking to create complex field values within entities, Field Collection is where you should go.

Fieldable Field is specifically about creating complex field values for Field Settings and for FieldInstance Settings. If you are looking to store complex values on a Bundle by Bundle basis (or a Field by Field basis), Fieldable Field is for you

Implementation Design:

  • Create a FieldSettingsEntity EntityType
  • Attach a FieldSettingsEntity to each FieldSettings, and manage loading of that both on the FieldSettings form, and into the FieldSettings when the Field is loaded by the FieldAPI
  • Attach a FieldSettingsEntity to each FieldInstanceSettings, and manage loading of that both on the FieldInstanceSettings form, and into the FieldInstanceSettings when the FieldInstance is loaded by the FieldAPI
  • Create the FieldSettingsEntity s such that FieldUI can offer an interface to field these FieldSettingsEntity-Field and FieldSettingsEntity-FieldInstance Bundles

Current Activity:

Research FieldCRUD API and FieldAttach API, to determine if this behaviour can be implemented using those hooks