function theme_nodehierarchy_parent_selector in Node Hierarchy 6.3
Same name and namespace in other branches
- 6.2 nodehierarchy.module \theme_nodehierarchy_parent_selector()
- 7.4 nodehierarchy.admin.inc \theme_nodehierarchy_parent_selector()
- 7.2 nodehierarchy.module \theme_nodehierarchy_parent_selector()
Theme the parent selector pulldown, allowing for disabled options.
1 theme call to theme_nodehierarchy_parent_selector()
- _nodehierarchy_get_parent_selector in ./
nodehierarchy.module - Get the parent selector pulldown.
File
- ./
nodehierarchy.module, line 1629 - A module to make nodes hierarchical.
Code
function theme_nodehierarchy_parent_selector($element) {
$select = '';
_form_set_class($element, array(
'form-select',
));
// Assemble the options.
$options = '';
foreach ($element['#options'] as $key => $option) {
$attributes = '';
// If the option represents a parent item (and not just the none option).
if ($item = @$element['#items'][$key]) {
if (@$element['#value'] == $key) {
$attributes .= ' selected="selected"';
}
if (@$item['disabled']) {
$attributes .= ' disabled="disabled"';
$option .= '*';
$element['#description'] = t('Nodes marked with a * cannot be a parent for this node because they are not an allowed parent type.');
if (user_access('administer hierarchy')) {
$element['#description'] .= t(' To allow these nodes to be parents of this node, change the setting for that node type in the !settings', array(
'!settings' => l(t('Node Hierarchy settings'), 'admin/settings/nodehierarchy'),
));
}
}
}
$options .= '<option value="' . check_plain($key) . '"' . $attributes . '>' . $option . '</option>';
}
return theme('form_element', $element, '<select name="' . $element['#name'] . '"' . drupal_attributes($element['#attributes']) . ' id="' . $element['#id'] . '">' . $options . '</select>');
}