function properties_template_admin_add_more_submit in Dynamic properties 7
Submit handler for the "Add another item" button of a field form.
This handler is run regardless of whether JS is enabled or not. It makes changes to the form state. If the button was clicked with JS disabled, then the page is reloaded with the complete rebuilt form. If the button was clicked with JS enabled, then ajax_form_callback() calls field_add_more_js() to return just the changed part of the form.
1 string reference to 'properties_template_admin_add_more_submit'
- properties_template_admin_templates_form in properties_template/
properties_template.admin.inc - Form builder; Add/Edit form for templates.
File
- properties_template/
properties_template.admin.inc, line 305 - Contains admin menu callbacks for properties_template.module.
Code
function properties_template_admin_add_more_submit($form, &$form_state) {
$form_state['template']->categories[] = (object) array(
'label' => '',
'name' => '',
'weight' => count($form_state['template']->categories),
);
foreach ($form_state['template']->categories as $name => $category) {
if (is_int($name)) {
unset($form_state['input']['categories'][$name]);
}
}
$form_state['rebuild'] = TRUE;
}