backdrop-contrib / paragraphs

Paragraphs module to control your content flow
https://backdropcms.org/project/paragraphs
GNU General Public License v2.0
5 stars 11 forks source link

Notice: Undefined variable: destination #67

Closed oadaeh closed 4 years ago

oadaeh commented 4 years ago

This PHP notice sometimes shows up in the logs when doing things with Paragraphs.

Here's the whole error:

Notice: Undefined variable: destination in paragraphs_field_edit_form_submit() (line 423 of paragraphs/1.x-1.x/paragraphs.module).

Here is the function in paragraphs.module where it is happening:

/**
 * Submit callback for paragraphs field settings form.
 *
 * @see paragraphs_form_field_ui_field_edit_form_alter
 */
function paragraphs_field_edit_form_submit($form, &$form_state) {
  $instance = $form['#instance'];
  $form_state['redirect'] = array('admin/structure/paragraphs/' . $instance['bundle'] . '/fields/' . $instance['field_name'] . '/delete', array('query' => $destination));
}

At the end of that last line is the variable $destination, which is not defined in the function.

oadaeh commented 4 years ago

The function probably needs something like $destination = backdrop_get_destination(); before it is used, but I didn't test that to verify.

oadaeh commented 4 years ago

The code was added in this commit:

commit e415e8b806c1598c587bdbf56d451cc2f0f48cd5 (tag: 1.x-1.1.0-beta)
Author: laryn <laryn@cedc.org>
Date:   Wed Apr 22 16:49:59 2020 -0500

    #57: Fix delete button on field configuration page

For this issue: https://github.com/backdrop-contrib/paragraphs/issues/57

laryn commented 4 years ago

Thanks @oadaeh ! https://github.com/backdrop-contrib/paragraphs/commit/bd521519447c8fc70655c56857cf20f1320afefb