I was reading the code for making draggable tables when I saw this...

    foreach (Element::children($links) as $id) {
      if (isset($links[$id]['#item'])) {
        $element = $links[$id];

        $form['links'][$id]['#item'] = $element['#item'];

        // TableDrag: Mark the table row as draggable.
        $form['links'][$id]['#attributes'] = $element['#attributes'];
        $form['links'][$id]['#attributes']['class'][] = 'draggable';

        $form['links'][$id]['#item'] = $element['#item'];

        // TableDrag: Sort the table row according to its existing/configured weight.
        $form['links'][$id]['#weight'] = $element['#item']->link->getWeight();

The line $form['links'][$id]['#item'] = $element['#item']; is duplicated.

Here's a simple patch who remove it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pol created an issue. See original summary.

Pol’s picture

Pol’s picture

Status: Active » Needs review
tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Yup, looks good. Thanks!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed fc20eda on 8.1.x
    Issue #2652556 by Pol: Remove duplicate lines in MenuForm.php
    

  • catch committed b26bac9 on
    Issue #2652556 by Pol: Remove duplicate lines in MenuForm.php
    
    (cherry...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.