Currently, it is assumed that there is a 'title' field placed in the views row. But, in scenarios where this is used with a custom entity that may not have a title field, an unknown index warning is shown for each item on the admin page. Patch to follow to simply add an isset check. This will remove the warning, but prevents the addition of the indentation item in `draggableviews_preprocess_views_view_table`.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anthonysimone created an issue. See original summary.

anthonysimone’s picture

anthonysimone’s picture

Updated patch attached, error with the above

Denes.Szabo’s picture

Status: Active » Reviewed & tested by the community

The patch #3 solved the title notice problem. Thx!

iStryker’s picture

Status: Reviewed & tested by the community » Needs work

This is from https://www.drupal.org/node/2826523#comment-12010818

Hi,

Instead of using

$title = isset($row['columns']['title']['content'][0]['field_output']['#markup']) ?: NULL;

Maybe use some kind of logic like this:

    $label_column = $variables['result'][$key]->_entity->getEntityType()->getKey('label');
    $title = $row['columns'][$label_column]['content'][0]['field_output']['#markup'];
    $indent = [
      '#theme' => 'indentation',
      '#size' => $draggableviews->getDepth($key),
    ];
    $variables['rows'][$key]['columns'][$label_column]['content'][0]['field_output']['#markup'] = render($indent) . $title;

To retrieve the real "label" column. Maybe we must check if a "label" key exists and add the isset like in the patch.

iStryker’s picture

iStryker’s picture

Status: Needs work » Needs review
FileSize
1.55 KB

Attached is a patch that finds the first column that is not the draggableviews field. Once hierarchy is working then it will add the indentation.

iStryker’s picture

  • iStryker authored 60a7896 on 8.x-1.x
    Issue #2876749 by anthonysimone, iStryker: Adjust draggable views to not...
iStryker’s picture

Status: Needs review » Fixed

Committed

Status: Fixed » Closed (fixed)

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