Skip to main content
added 2816 characters in body
Source Link
grm
  • 355
  • 2
  • 10

Edit:

A regular fields received through user registration might look like this:

name
... (Array, 10 elements)
#type (String, 9 characters ) textfield
#title (String, 10 characters ) Username
#maxlength (Integer) 60
#required (Boolean) TRUE
#attributes (Array, 1 element)
class (Array, 1 element)
0 (String, 8 characters ) username
#default_value (String, 0 characters )
#access (Boolean) TRUE
#weight (Integer) -10
#fb_registration_field (String, 4 characters ) name

A form container looks e.g. like this:

field_birtyday
... (Array, 6 elements)
#type (String, 9 characters ) container
#attributes (Array, 1 element)
#weight (String, 1 characters ) 7
#tree (Boolean) TRUE
#language (String, 3 characters ) und
und (Array, 13 elements)
0 (Array, 12 elements)
#entity_type (String, 4 characters ) user
#bundle (String, 4 characters ) user
#field_name (String, 14 characters ) field_birtyday
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)
#columns (Array, 2 elements)
0 (String, 5 characters ) value
1 (String, 6 characters ) format
#title (String, 8 characters ) Birthday
#description (String, 0 characters )
#required (Boolean) FALSE
#delta (Integer) 0
#weight (Integer) 0
value (Array, 16 elements)
#entity_type (String, 4 characters ) user
#bundle (String, 4 characters ) user
#field_name (String, 14 characters ) field_birtyday
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)
#columns (Array, 2 elements)
0 (String, 5 characters ) value
1 (String, 6 characters ) format
#title (String, 8 characters ) Birthday
#description (String, 0 characters )
#required (Boolean) FALSE
#delta (Integer) 0
#weight (Integer) 0
#type (String, 9 characters ) textfield
#default_value (NULL)
#size (String, 2 characters ) 60
#maxlength (String, 3 characters ) 255
#attributes (Array, 1 element)
#theme (String, 25 characters ) field_multiple_value_form | (Callback) field_multiple_value_form();
#field_name (String, 14 characters ) field_birtyday
#cardinality (String, 1 characters ) 1
#title (String, 8 characters ) Birthday
#required (Integer) 0
#description (String, 0 characters )
#prefix (String, 42 characters ) <div id="field-birtyday-add-more-wrapper">
#suffix (String, 6 characters ) </div>
#max_delta (Integer) 0
#after_build (Array, 1 element)
0 (String, 30 characters ) field_form_element_after_build | (Callback) field_form_element_after_build();
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)

Edit:

A regular fields received through user registration might look like this:

name
... (Array, 10 elements)
#type (String, 9 characters ) textfield
#title (String, 10 characters ) Username
#maxlength (Integer) 60
#required (Boolean) TRUE
#attributes (Array, 1 element)
class (Array, 1 element)
0 (String, 8 characters ) username
#default_value (String, 0 characters )
#access (Boolean) TRUE
#weight (Integer) -10
#fb_registration_field (String, 4 characters ) name

A form container looks e.g. like this:

field_birtyday
... (Array, 6 elements)
#type (String, 9 characters ) container
#attributes (Array, 1 element)
#weight (String, 1 characters ) 7
#tree (Boolean) TRUE
#language (String, 3 characters ) und
und (Array, 13 elements)
0 (Array, 12 elements)
#entity_type (String, 4 characters ) user
#bundle (String, 4 characters ) user
#field_name (String, 14 characters ) field_birtyday
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)
#columns (Array, 2 elements)
0 (String, 5 characters ) value
1 (String, 6 characters ) format
#title (String, 8 characters ) Birthday
#description (String, 0 characters )
#required (Boolean) FALSE
#delta (Integer) 0
#weight (Integer) 0
value (Array, 16 elements)
#entity_type (String, 4 characters ) user
#bundle (String, 4 characters ) user
#field_name (String, 14 characters ) field_birtyday
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)
#columns (Array, 2 elements)
0 (String, 5 characters ) value
1 (String, 6 characters ) format
#title (String, 8 characters ) Birthday
#description (String, 0 characters )
#required (Boolean) FALSE
#delta (Integer) 0
#weight (Integer) 0
#type (String, 9 characters ) textfield
#default_value (NULL)
#size (String, 2 characters ) 60
#maxlength (String, 3 characters ) 255
#attributes (Array, 1 element)
#theme (String, 25 characters ) field_multiple_value_form | (Callback) field_multiple_value_form();
#field_name (String, 14 characters ) field_birtyday
#cardinality (String, 1 characters ) 1
#title (String, 8 characters ) Birthday
#required (Integer) 0
#description (String, 0 characters )
#prefix (String, 42 characters ) <div id="field-birtyday-add-more-wrapper">
#suffix (String, 6 characters ) </div>
#max_delta (Integer) 0
#after_build (Array, 1 element)
0 (String, 30 characters ) field_form_element_after_build | (Callback) field_form_element_after_build();
#language (String, 3 characters ) und
#field_parents (Array, 0 elements)
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link
grm
  • 355
  • 2
  • 10

How should I handle container form elements?

I have added some custom fields to the register user form and I'm discovered that they are sent back, packaged in a form element of type "container". My code needs to handle all kind of different custom register fields.

How should I parse these objects and extract the fields from them? Should I look into the arrays and what can I expect to find there?

I can't seem to find any good documentation on these objects.