function commerce_option_get_option_set_fields in Commerce Product Option 7.2
Ajax callback that replaces the fields-part of the form with the fields defined in the Commerce Option Set (type).
1 string reference to 'commerce_option_get_option_set_fields'
- commerce_option_form in ./
commerce_option.admin.inc - Commerce Option create/edit form
File
- ./
commerce_option.admin.inc, line 109
Code
function commerce_option_get_option_set_fields(&$form, &$form_state) {
$type = $form_state['values']['type'];
$option = commerce_option_new(array(
'set_id' => $type,
));
$subform = commerce_option_build_option_set_fields($form, $form_state, 'add', $option);
foreach (element_children($subform) as $key) {
$subform[$key] = form_builder('commerce_option_form', $subform[$key], $form_state);
}
$commands[] = ajax_command_replace('#commerce-option-fields', drupal_render($subform));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}