Commit 6ba70e85 authored by davisben's avatar davisben

added menu weight functionality

parent 9a61efce
......@@ -234,13 +234,25 @@ function weight_field_widget_info() {
* Implements hook_field_widget_form().
*/
function weight_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$node = $form_state['node'];
$settings = _weight_get_settings($node->type);
$element += array(
'#type' => 'select',
'#title' => t('Weight'),
'#options' => _weight_get_options($instance['settings']['range']),
'#default_value' => isset($items[0]) ? $items[0] : 0,
);
if ($settings['menu_weight']) {
$element['#default_value'] = $node->menu['weight'];
$element['#disabled'] = TRUE;
$element['#description'] = t('Weight cannot be selected when the menu weight option is in use.');
}
else {
$element['#default_value'] = isset($items[0]) ? $items[0] : 0;
}
return $element;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment