i use drupal + commerce + adressfield and i am cleaning up the checkout-page form markup (at least i try).

i am familiar with the theme functions of form.inc and have removed some divs aleady using this functions but one of the divs i dont know were it is defined.

dpm(); says it resides in $element['#children'] but ['#children'] is the whole markup including the div i want to remove.

to be clear: i want to remove the red marked outer div only!

enter image description here

  • That might not be the best idea - I think the 'add another' javascript functionality targets those wrappers specifically – Clive Jul 30 '13 at 18:12
  • thanks for comment but i want to understand were all this markup comes from. a check later will show what divs essentially needed. any more comments on this? thanks. – user19578 Aug 1 '13 at 10:30
  • I'd guess they're added by addressfield_process_format_form() (process function for the addressfield form element), might be a good place to start – Clive Aug 1 '13 at 10:35
  • inner elements are added by addressfield.module and adress.inc the origin of the marked div in red is still unknown. i had a look at your function and i dont think thats the right place. but thank you. – user19578 Aug 1 '13 at 11:22
  • ok got it. form.inc function function drupal_build_form($form_id, &$form_state) add there unset($form['customer_profile_billing']['commerce_customer_address']['und']['#prefix']); unset($form['customer_profile_billing']['commerce_customer_address']['und']['#suffix']); – user19578 Aug 1 '13 at 13:38

The user's answer in the comment is wrong. We never want to hack a module. But we can use hook_form_alter() to modify the #suffix and #prefix.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.