-
Notifications
You must be signed in to change notification settings - Fork 11
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
Call to a member function label() on null #28
Comments
This particular site seems to have an issue that I'll need to troubleshoot -- That said, it's possible it's something particular with this site. Any ideas more than welcome however... |
|
I'm having the same problem after installing paragraphs, and attempting to override I also noticed that for every paragraphs item, the paragraphs_item template is being applied twice. One time it only contains the class See related: backdrop-contrib/paragraphs#91 |
The ParagraphsItem
I think maybe this is the problem. Not only has this documentation not been updated (I'm sure that was supposed to say I'm going to fiddle with this and see if changing the |
Well, progress? If I change the theme hook here, the page seems to render correctly (with my template only applied once). But I don't know how to check the theme registry to see if a specific function is provided, so I ended up with this mess:
...as well as some PHP errors. I'm going to sort through the errors and see if it sheds any other light. |
The PHP errors were helpful :) I think I found a fix for backdrop-contrib/paragraphs#91.
I suspect this issue may be specific to all sites with Paragraphs. Since implementing the fix above I haven't encountered this problem anymore. If someone else can confirm, maybe we can close this? |
Thank you @jenlampton -- the preliminary testing in the Paragraphs thread you linked looks promising enough that I'll close this one here. Thanks so much! |
Reopening as the fix in the Paragraphs queue breaks some preprocessing functionality. @hosef do you have any insight on how this might relate in Entity Plus's implementation where Paragraphs items are getting rendered twice? From @jenlampton in the Paragraphs thread:
|
@jenlampton mentioned the view method above. @herbdool just mentioned that separately. Could this relate? I haven’t had time to dig but wanted to make the connection in a comment just in case: |
@laryn I'm looking into this issue, but I'm not clear how to reproduce the error. I installed paragraphs and it's working fine so far. Can you give me a clue on how to reproduce it? |
Add a template override for paragraphs-item.tpl.php in your theme, even if just copying the one from the paragraphs module. |
@laryn maybe try |
I think you are aware of this, but looking at the themed output, it looks like there is some theme nesting going on. Compare to D7's output below. Currently Drupal 7 Paragraphs does not have a template_preprocess_paragraphs_item function, while Backdrop does. In Drupal template_preprocess_entity is called once per paragraph instance. Backdrop calls it twice, and calls template_preprocess_paragraphs_item as well. I don't know what all of this means, but I'll sleep over it. I'll keep looking into this tomorrow... |
@laryn , after moving the HOWEVER, after quick inspection, I can confirm that the current version of Paragraph is double-printing (calling twice or three times per field) the I discovered that @jenlampton had reported exactly this markup problem in backdrop-contrib/paragraphs#91 (comment) and she provided a PR that actually solves this. I will continue this conversation there. In the meantime, if you could let me know about my tpl modifications questions I typed at the top of this comment I could test and see if I'm able to reproduce the error of this issue. |
@laryn I was able to reproduce the error reported here by enabling Modal Administration for Paragraphs, and by using a template file in the theme's folder rather than the one provided by the the module. So, that's progress. I have a hunch that this (as well as backdrop-contrib/paragraphs#91) is all caused by the double call of template file. I don't think this is a bug in Entity Plus, but rather an issue produced by that double call. The Paragraphs PR backdrop-contrib/paragraphs#92 eliminated the double invocation of the template and produced a more sensible html markup output, BUT it interfered with the Modal Administration. I believe you re-added the #theme_wrappers line in Paragraphs here to solve the Modal issue, according to the comments you inserted above that line. I'm going to try to focus on making the Paragraph's Modal Administration work without re-adding that #theme_wrappers line. For starters, there is an issue with how classes are applied in I'll keep you posted on any progress. |
This issue was the result of issues with Paragraphs that have been resolved. See backdrop-contrib/paragraphs#110. Closing. |
I upgraded a few modules on a dev site and started getting a maintenance screen with this error:
Call to a member function label() on null
.I tracked it down to
entity_plus.theme.inc
where it's trying to set the$entity
variable, but in at least one case that was apparently null. Does that make any sense to you @hosef? For the moment I'm just blocking the whole section intemplate_preprocess_entity_plus
with aif (!empty($variables['elements']['#entity'])) {
...The text was updated successfully, but these errors were encountered: