function _name_component_layout in Name Field 7
Same name and namespace in other branches
- 8 name.module \_name_component_layout()
Sorts the widgets according to the language type.
1 call to _name_component_layout()
- name_element_pre_render in ./
name.module - This function themes the element and controls the title display.
File
- ./
name.module, line 834 - Defines an API for displaying and inputing names.
Code
function _name_component_layout(&$element, $layout = 'default') {
$weights = array(
'asian' => array(
'family' => 1,
'middle' => 2,
'given' => 3,
'title' => 4,
// 'generational' is removed from the display
'generational' => 5,
'credentials' => 6,
),
'eastern' => array(
'title' => 1,
'family' => 2,
'given' => 3,
'middle' => 4,
// 'generational' is removed from the display
'generational' => 5,
'credentials' => 6,
),
);
if (isset($weights[$layout])) {
foreach ($weights[$layout] as $component => $weight) {
if (isset($element[$component])) {
$element[$component]['#weight'] = $weight;
}
}
}
if ($layout == 'asian') {
if (isset($element['generational'])) {
$element['generational']['#default_value'] = '';
$element['generational']['#access'] = FALSE;
}
}
}