Subfields

Component ID

2301087

Component name

Subfields

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1126

Component created

Component changed

Component body

Subfields is an implementation of core's Field UI that allows you to split a single field into as many sub-fields as you like. It is a lot like Composed Field, but each value is stored as a text string so it is searchable and available to Views.

You can configure each sub-field type as if it were literally a single field. This module only supports select list and textfield input boxes. But is also provides a regex validation handler to validate that appropriate data is provided.

Features

Regex validation (preg_match) on input fields.
Prefix/suffix gets tacked onto fields and stored with the single string.
Full Views and Entity Field Query support.

How does it work?

Each field stores its value as a serialized array and string in the database.

  • Each array element represents the sub-field value. After that the array is serialized and stored into the database as a single value.
  • The string value concatenates the prefix, value and suffix together, along with all other subfield field elements and gets stored as a single value. Now its searchable by Views and Entity Field Query


Similar Modules

  • Composed Field does not store each of the values as a simple string. So it doesn't support Views and Entity Field Query. That module also doesn't provide a mechanism for providing a simple regex validation. One has to use evaluated PHP.

How to use

Once you enable this module you will have a new Subfields field type available in the Field UI.

Sponsored by Forum One Communications