Objective: To override the default classes and divs that are spit out from the Form-API from my custom addressfield implementation in a Drupal Commerce checkout pane. I need to make the classes/divs predictable based on the number of seperate address forms their are. I dynamically create (x) addressfields based on the number of gift subscriptions (x) so that I can combine address information for subscriptions.
Note: The addressfield form is a patch from the addressfield module which creates a form element type. This looks like this:
$form['address'] = array( '#type' => 'addressfield', '#required' => TRUE, '#title' => t('Recipient\'s Address'), '#context' => array('countries' => array('AT', 'AS', 'BE', 'BG', 'CA', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'GU', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PR', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB', 'UM', 'US', 'VI'), ''), '#default_value' => array('country' => 'US'), '#description' => "Please enter the address you want to mail this gift to.", '#maxlength' => 60, );
However the problem arises when you load the page with the form. Drupal is dynamically creating numbers in the classes/divs that appears to be random. I would like to specify that number so that it conincedes with the number of subscriptions. So when i test i select (2) gift subscriptions and get and .
As opposed to the current way it does things (screenshot)