I am getting Warning after updating draggableviews to 2.1.2. Like-

Warning: Undefined property: Drupal\views\ResultRow::$draggableviews_structure_parent in Drupal\draggableviews\DraggableViews->getDepth() (line 59 of modules/contrib/draggableviews/src/DraggableViews.php).

I think we need to add (!empty($row->draggableviews_structure_parent)) ? condition before assign value to $parentIndex at line number 59 in DraggableViews.php too.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

santoshparbat created an issue. See original summary.

Ranjit1032002 made their first commit to this issue’s fork.

ranjit1032002’s picture

Status: Active » Needs review

The condition !empty($row->draggableviews_structure_parent) will return true if the property is not empty, which is the opposite of what you want.
created MR!23 for the issue mentioned, please review.
Thank you.

jcandan’s picture

Title: Warning: Undefined property: Drupal\views\ResultRow::$draggableviews_structure_parent » Fix undefined property warning draggableviews_structure_parent
jlecinaj’s picture

Couldn't reproduce the issue with last version.

Version used: 2.1.3

Steps to reproduce in case it still happens.

istryker’s picture

ChatGPT

The empty() function already checks for null, false, empty strings, empty arrays, and zero values, so there's no need to check for false and empty separately.

So it looks like we can just simplify this.

  • istryker committed aadede78 on 2.1.x
    Issue #3354600 by ranjit1032002, istryker: Fix undefined property...
istryker’s picture

Version: 2.1.2 » 2.1.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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