Notice: Undefined index: table in paragraphs_preprocess_field_multiple_value_form() (line 353 of modules\contrib\paragraphs\paragraphs.module). 

It was added in this commit:
https://cgit.drupalcode.org/paragraphs/commit/?id=0268cf9

I have my paragraph widget with multiple elements where tabledrag is removed by default. There was no notice until this commit.

Comments

Pasqualle created an issue. See original summary.

miro_dietiker’s picture

Status: Active » Postponed (maintainer needs more info)

We have great code coverage and use the module in complex setups and didn't hit this problem until now.
Please provide a description of the minimum configuration to reproduce the issue. Otherwise we can't look into the problem.

pasqualle’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new8.36 KB

I have created a widget which displays multi-value paragraphs as columns (without tabledrag). The base of the widget is:

class ColumnsParagraphsWidget extends InlineParagraphsWidget {
 public function formMultipleElements(
   ...
   $is_multiple = FALSE; // No tabledrag.
   ...
  }
}

attached full code of the widget

pasqualle’s picture

Status: Active » Needs review
StatusFileSize
new651 bytes

Status: Needs review » Needs work

The last submitted patch, 4: 2952955-4-undefined_index.patch, failed testing. View results

toncic’s picture

Issue tags: +Needs tests

Would be nice if we can write test for this.

edutrul’s picture

StatusFileSize
new56.87 KB

Apart from table undefined index, also in dblog there's another issue which is undefined #cardinality
I think for both cases should be added defensive programming
see:

this would be like this:

  if ((isset($variables['element']['#allow_reference_changes']) && !$variables['element']['#allow_reference_changes']) ||
    (isset($variables['element']['#mouse']) && $variables['element']['#cardinality'] == 1) ||
    (isset($variables['table']['#rows']) && count($variables['table']['#rows']) == 0)) {

Shortly I am posting a patch

edutrul’s picture

I attach patch https://www.drupal.org/files/issues/2018-08-19/paragraphs-fix-undefined-... which adds defensive programming and fixes above issues from #7

edutrul’s picture

My mistake - I am re-uploading patch since the previous one was empty.
https://www.drupal.org/files/issues/2018-08-19/paragraphs-fix-undefined-...

maximpodorov’s picture

So both #4 and #9 patches should be applied, right? If so, it's better to combine them into one.

miro_dietiker’s picture

Status: Needs work » Needs review

I think this was fixed recently in some other issue.

The last submitted patch, 8: paragraphs-fix-undefined-issue-2952955-8.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 9: paragraphs-fix-undefined-issue-2952955-9.patch, failed testing. View results

miro_dietiker’s picture

Status: Needs work » Postponed (maintainer needs more info)

For now needs info, will switch to duplicate without reply.

juampynr’s picture

Confirmed: these warnings are gone using 8.x-1.x

miro_dietiker’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

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