Commit 57eb86d6 authored by Ben Davis's avatar Ben Davis

Issue #1526564 by 10oclock: Undefined index: #options in weight_form_node_admin_content_alter()

parent f5531657
......@@ -98,7 +98,14 @@ function weight_form_node_admin_content_alter(&$form, &$form_state) {
if (user_access('assign node weight')) {
$weight_types = _weight_get_types();
foreach ($form['admin']['nodes']['#options'] as $nid => $node) {
if (!empty($form['admin']['nodes']['#options'])) {
$nodes = $form['admin']['nodes']['#options'];
}
else {
$nodes = $form['admin']['nodes']['#rows'];
}
foreach ($nodes as $nid => $node) {
$node = node_load($nid);
if (in_array($node->type, $weight_types)) {
$settings = _weight_get_settings($node->type);
......@@ -137,8 +144,15 @@ function _weight_set_ajax($form, $form_state) {
function weight_node_admin($form_element, &$form_state) {
$form_element['admin']['nodes']['#header']['weight']['data'] = t('Weight');
foreach ($form_element['admin']['nodes']['#options'] as $nid => $node) {
$form_element['admin']['nodes']['#options'][$nid]['weight']['data'] = $form_element['weight'][$nid];
if (!empty($form['admin']['nodes']['#options'])) {
$key = '#options';
}
else {
$key = '#rows';
}
foreach ($form_element['admin']['nodes'][$key] as $nid => $node) {
$form_element['admin']['nodes'][$key][$nid]['weight']['data'] = $form_element['weight'][$nid];
}
unset($form_element['weight']);
......
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