function term_level_element_process in Term Level Field 7
Processes the term_level element type.
1 string reference to 'term_level_element_process'
- term_level_element_info in ./
term_level_element.inc - Implements hook_element_info().
File
- ./
term_level_element.inc, line 27 - term_level_element form type
Code
function term_level_element_process($element, $form_state) {
$module_path = drupal_get_path('module', 'term_level');
$element['#attached']['css'][] = $module_path . '/term_level.css';
$element['#attached']['js'][] = $module_path . '/term_level.js';
$element['#attached']['js'][] = array(
'data' => array(
'termLevel' => array(
'term-level-element-table-' . $element['#vid'] . '-' . $element['#parent'],
),
),
'type' => 'setting',
);
$element['#levels']['none'] = t('None');
$element['terms'] = array();
foreach ($element['#terms'] as $term) {
$element['terms'][$term->tid] = array(
'#type' => 'radios',
'#weight' => isset($term->row_weight) ? $term->row_weight : 0,
'#options' => $element['#levels'],
'#default_value' => isset($term->level) ? $term->level : NULL,
'#tid' => $term->tid,
);
$element['terms'][$term->tid]['term-name'] = array(
'#markup' => check_plain($term->name),
);
}
$tag_cloud_term_options = array();
$tag_cloud_markup = term_level_element_get_tag_cloud($element['#tag_cloud_terms'], $tag_cloud_term_options);
$element['tag_cloud_term_links'] = array(
'#markup' => $tag_cloud_markup,
);
$element['tag_cloud_term_options']['select'] = array(
'#type' => 'select',
'#options' => $tag_cloud_term_options,
'#default_value' => 0,
);
$element['tag_cloud_term_options']['add'] = array(
'#type' => 'submit',
'#value' => t('Add to @parent', array(
'@parent' => $element['#title'],
)),
'#name' => 'term-level-add-' . $element['#vid'] . '-' . $element['#parent'],
'#submit' => array(
'term_level_element_add_terms_submit',
),
'#limit_validation_errors' => array(),
'#term_level_parent' => $element['#parent'],
'#vid' => $element['#vid'],
'#ajax' => array(
'event' => 'click',
'callback' => 'term_level_element_ajax_callback',
),
);
return $element;
}