Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Does not currently support field_collection module.
The only problem I see is in cck_select_other_widget_validate()
Change:
elseif (!empty($reversed) && isset($form_state['field']['#parents'])) {
// Profile 2 exception.
// $container = array_shift($reversed);
// $field = $form_state['field']['#parents'][$container]['#fields'][$field_name];
// $values = &$form_state['values'][$container];
// MY CHANGE
// We aren't using Profile 2 but are using field collections so will make that work here instead
$container_delta = array_shift($reversed);
$container_langcode = array_shift($reversed);
$container = array_shift($reversed);
$field = $form_state['field']['#parents'][$container][$container_langcode][$container_delta]['#fields'][$field_name];
$values = &$form_state['values'][$container][$langcode][$delta];
}
I don't have profile 2 installed right now so can't develop a way to make them both work but maybe check if container is numeric. If it is numeric, it is in fact the container's delta followed by it's language then field name. If, when using profile 2, the container name is the last element of $reversed perhaps could use array_pop to get the container name then load the field with field_info_field() to see how to proceed.
Comments
Comment #1
mradcliffeFixed in 7.x-2.x branch with rewrite of element parent handling.
Comment #2
Sarenc CreditAttribution: Sarenc commentedThe new version works great - Thanks!!
Comment #3
mradcliffeThank you for the feedback.