Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notice in layout_context_required_by_path() when adding a layout that triggers the dashboard context #4077

Open
hosef opened this issue Sep 23, 2019 · 4 comments · May be fixed by backdrop/backdrop#3116

Comments

@hosef
Copy link

hosef commented Sep 23, 2019

Description of the bug
A PHP notice is issued when creating a layout below the admin/dashboard/ path.

Steps To Reproduce
To reproduce the behavior:

  1. Go to '/admin/structure/layouts/add'
  2. Create a new layout using a path starting with 'admin/dashboard/'
  3. Go to the new layout or the edit page for the new layout

Actual behavior
There will be several entries in the log with a message similar to
Notice: Undefined index: path placeholder in layout_context_required_by_path()

Expected behavior
There should not be any errors

Additional information
It appears that the layout module assumes that layout contexts will have some kind of placeholder, and throws errors when it does not. Either we need to change the way contexts are handled, or we need to add a path placeholder value to dashboard_layout_context_info()

@stpaultim
Copy link
Member

Just a note. I was able to create layouts that start with admin/ or admin/content. The problem seems to be specific to admin/dashboard/

@oadaeh
Copy link

oadaeh commented Apr 13, 2020

The problem is that the 'path placeholder' element as defined in hook_layout_context_info() is missing. The documentation says that it's optional, but the element itself is not optional, only the value, because line 1751 of layout_context_required_by_path() checks the value without first making sure it is set.

I think the bug is actually either in the documentation or in the layout_context_required_by_path(), but I've submitting a pull request to fix dashboard_layout_context_info() (if I did it right), based on how it is handled in layout_layout_context_info().

PS: If layout_context_required_by_path() is modified to check 'path placeholder', then it should also check 'menu paths', which has the same problem.

@oadaeh
Copy link

oadaeh commented Apr 10, 2021

Hmm, I am now seeing these layout-based PHP notices when saving a view I created. If I can pin down the specifics there, I'll post them here (though I'm actually debugging a different problem, ATM).

@argiepiano
Copy link

I'm seeing this error again in Backdrop 1.25.1 and PHP 7.4. Any chance to rebase this PR to get this fixed, @oadaeh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants