-
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
Error when overwriting paragraphs-item.tpl.php #91
Comments
Ah, maybe you can help me track this down, @neessen! I have this happening on one site only and haven't been able to figure out what is causing it. See here for a hack/workaround: Maybe we can determine the conditions that cause this and fix in either Paragraphs or Entity Plus... |
Hey Laryn I have printet the paragraphs field in the node.tpl like this:
As soon as I create the file "paragraphs-item.tpl.php" in the templates folder with the default markup it generates the error mentioned above. Content of file:
The error is not present when this file is not in the templates folder. Going to the entity.module file line 673 and changing to this:
Generates a new error:
Changing line 655 to this
Makes it work (it doesnt break the site with a php error), but gives me a pile of warnings:
But changing the core files is obviously not the best idea, and that is a lot of warnings, so I wonder if there is another workaround? :) And also (I dont know if this is intended), but it seems that entity plus is somehow duplicating the markup in the paragraphs-item.tpl.php file. If i give the .content div an extra class (TEST) the result is this:
And if I print some markup at the bottom of the paragraphs-item.tpl.php e.g.:
It prints "TEST TEXT" twice below the paragraph content of each paragraph content. |
I have been looking at this some more, and it seems like it is the "printing twice" part that is causing all the issues.
E.g. However this hook should only be called once so this shouldn't be an issue at all.
As a temporary fix, i have wrapped the content of the template_preprocess_entity_plus() function in an if statement, but that does not fix the fact that the hook is being called twice which i dont think it should, so if you have any idea to why, or have to properly fix it, I would really appreciate it.
|
Hey @laryn |
I'm experiencing the same problem. @neessen thank you for the temporary fix! I'm also seeing the entity_plus theme markup wrapping my paragraph item twice: This is particularly problematic if, for example, your paragraph template split the area into two columns. When the template is applied twice, the second rendering splits the same area into two more columns, making everything half the size it should be. I'm seeing the paragraph_item template being applied to the paragraph item, as expected, but then it's applied again when I think the underlying problem is somewhere in entity_plus. |
Okay, so I think I'm getting closer. At the time In spite of that, calling Now to find out where that got pre-rendered...
|
@neessen @jenlampton Sorry, I haven't been able to get back to this yet. Thanks to you both for digging around in it! |
Bingo! I've filed a PR that fixes the double template problem on my site :) I think the problem was that we were telling the paragraph item to use the I don't like how |
@jenlampton I can confirm on a quick test that this seems to solve it on the site I was seeing this on, with no ill-effects noticed! Amazing. @neessen Can you confirm as well? |
@jenlampton, I'm a maintainer on Entity Plus mainly because I needed to get a few fixes merged to make some other modules functional. My sense is there have been some gaps that need polish in a variety of places, so "as intended" may be used quite loosely here. Please feel free to open an issue in Entity Plus, however. There has been some traction on issues from others that are using it and it may open a conversation. |
@jenlampton I can confirm it works as well :) Thank you for your help on this @jenlampton and @laryn, I appreciate it :) |
Thanks @jenlampton for the work to track this down and for the PR that fixes it! Thanks @neessen for reporting and helping to test. I've merged #92 into 1.x so it will be in the next release of Paragraphs. |
@jenlampton or @neessen I was testing this further prior to formal release and there may be an issue (or a further modification needed). Are either of you using |
I think I tried to use that function and failed, but then assumed that it wasn't supposed to work. I should have looked more closely! |
@laryn yes I have used that hook on other sites, but not the one where I had this issue, so I didn't realise that it could have any impact. Have you had a chance to investigate why it has impact on that hook? |
@neessen Not yet. But we'll need to figure it out (either in Paragraphs or Entity Plus) before the next release. |
@neessen @jenlampton FYI I've added this line back in the alpha1 pre-release, realizing it's not a solution yet. Before we get to a full release we'll have to have solved this either here or in Entity Plus. But I want people to be able to start testing some of the other changes and I think a pre-release may make that easier for some folks. |
Interestingly, I realized I had just copied an older version of |
I'm continuing the conversation here, from the related issue #28. My strong suspicion is that #28 and this issue are closely related and are the result of using I can confirm that the PR she provided resolves the double use of the tpl, which takes care of the nested divs with the same classes (see graph in backdrop-contrib/entity_plus#28 (comment)) I also found some Drupal commits that actually removed the use of that wrapper. See this commit. Drupal 7's current version of Paragraphs doesn't have that declaration of The drawback of removing the I think the next step is to try to reproduce this issue and also #28 after applying PR #91. @laryn, if you could help me reproduce the error that'd be great. I tried what you mentioned in #28 but no luck so far. |
Trying to reproduce the error after applying #92 by following @laryn 's report, but still no warnings or errors. And the html markup is correct, without the nested divs with same classes
|
Maybe avoid using entity plus version of |
Success!!! The modal is working fine now, no errors, and the template file is also in the theme folder. I will create a new issue and PR in a few minutes. Basically what I did:
To summarize the source of the error: the use of #theme_wrappers and the resulting rewriting of the template file was causing all of this. Preprocessing in Entity Plus is confusing. One would logically assume that the following preprocess hook would work: I will create a new issue a submit a PR with all of this in a few minutes. |
@argiepiano awesome! I haven't tested but that's great that you unraveled this knot. |
HUGE shout out to @argiepiano who stepped in and crushed this one in #113. Latest I was a little over-eager in releasing this next alpha -- almost immediately afterwards I realized one minor tweak that should help with backwards compatibility: 369b4a9 I made note in the release notes but there may be some minor tweaks needed to custom implementations of |
Nice work - just upgraded to the |
Great! I'm going to close this issue -- please reopen or open a new issue if something comes up with the latest release. |
I have Paragraphs 1.x-1.1.0 and Entity Plus 1.x-1.0.13 installed, and getting an error when copying paragraphs-item.tpl.php from paragraphs module folder to the templates folder of the theme:
The text was updated successfully, but these errors were encountered: