I'm sure there is a function to help with this by I can't find it in the API docs. What I want to do is: in a hook_form_alter, iterate over all of an element's items and and manipulate them.
The example form below is from a bean form which has a multivalue field collection called field_listing_articles. I want to iterate over all the instances of that element. They are located in the form under field_listing_articles -> und -> 0, 1, 2 etc
If I do a foreach and iterate over $form['field_listing_articles'][LANGUAGE_NONE] I will pick up all the other (non-numeric) parts of the form at that level. I realise I could put an if is_numeric condition in there but I'm sure there is a more 'Drupal' way of doing this.
Any advice appreciated.
$form
--label
--title
--view_mode
--bean
--actions
--#validate
--#submit
--#parents
--#entity
--field_listing_articles
----#type
----#attributes
----#weight
----#tree
----#language
----und
------0
------1
------2
------3
------4
------5
------6
------#theme
------#field_name
------#cardinality
...etc