function properties_template_submit_select_template in Dynamic properties 7
Submit callback to add categories of a template to the form.
1 string reference to 'properties_template_submit_select_template'
- properties_template_field_attach_form in properties_template/
properties_template.module - Implements hook_field_attach_form().
File
- properties_template/
properties_template.module, line 236 - This module implements the template functionality for properties.
Code
function properties_template_submit_select_template($form, &$form_state) {
$field_name = $form_state['triggering_element']['#parents'][0];
$langcode = $form[$field_name]['#language'];
$values = $form_state['values'][$field_name][$langcode]['actions'];
// Load categories of template and add them to the form.
if (!empty($values['template'])) {
$template = properties_template_load($values['template']);
$categories = properties_category_load_multiple(array_keys($template->categories));
foreach ($template->categories as $cname => $c) {
$category = $categories[$cname];
properties_widget_add_category($category, $form_state, $field_name, $langcode);
}
}
$form_state['rebuild'] = TRUE;
}