-
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
Page Preview Not Working #136
Comments
Can you describe "not working" in more detail please? How to reproduce? |
We are using different paragraph types for our content and they work perfectly when we Save and View the page but if we try the Preview button there seen nothing on that Preview page. In Simple, Paragraphs are not working on the Preview page. |
As @sudipto68 reported. If I click on the preview I see the page title and the blocks that appear below the page content, but the page content is not visible at all - there is no preview of the content contained within the paragraphs on that page. |
@laryn and @stpaultim, I've done a bit of debugging on why the Preview button doesn't show the Paragraph fields in a node. So, in Backdrop, Paragraphs implements hook_field_prepare_view() (in file paragraphs.field_formatter.inc). I don't know what the purpose of this implementation is, but I suspect it's related to the experimental modal administration. The issue is that, in that hook, the function assigns a value of 'scratch_paragraph` to the Paragraph item, I think ONLY when you are in editing mode (once the node is saved, the value is actually the paragraph item ID). So, I commented out I'm not a maintainer of this module and don't quite have the time to thoroughly test, but I thought I mentioned what I've found in case someone wants to fix this. |
Also tried leaving hook_field_prepare_view() as is, and commenting out lines 101-107 in paragraphs_field_formatter_view() and that also works for the Preview... |
@argiepiano Thanks. I'm not sure that I'll be able to fix this. But, maybe I can recruit someone who can. |
A couple more thoughts: I have tested by removing BOTH So the key is to figure out if there is any situation when avoiding the rendering of the field, and This is what I removed in // If we are dealing with an empty paragraphs field, render an insert point.
if ($items[0]['value'] == 'scratch_paragraph') {
if (!empty($instance['settings']['modal_admin'])) {
$entity_ids = entity_extract_ids($entity_type, $entity);
}
return $element;
} |
Just wanted to add that this has to be looked at carefully. I haven't tested in all situations, e.g. nested paragraphs... |
@argiepiano Thanks for digging into this as much as you have. If memory serves, the @stpaultim I'm not sure when I'll be able to get to this so feel free to recruit someone before then if you are able. |
@argiepiano and @laryn thanks for figuring out this issue. We tested commenting out both the |
I have submitted a PR Based on the solution. Here is the PR 136 |
I must admit that I don't know if/how the modal admin works (which was part of https://www.drupal.org/files/issues/interdiff-2448677-20-24.txt which was merged). But I can see that the section in At any rate, I have also removed it in testing. But I've also changed
Because the node preview seems to ignore paragraphs nested in paragraphs but adding This is just a temporary fix though since the preview still doesn't seem to behave the same as a regular render - the preprocess functions are not running properly, somehow, that were required for some paragraphs types I've got in testing. |
I've now updated the PR to also prevent the I've separately figured out the issue I had with modal_admin appearing. It now seems to be fully working for me. @laryn @olafgrabienski would you like to take a look at the PR? Node preview should work with complex paragraphs types (such as in |
@herbdool, I can probably have a look by end of the week. |
@herbdool I've had a look at the updated PR. As far as I can see, the node preview works with Paragraphs (even complex types, e.g. Accordion, Cards, Media List). The modal admin links do not appear (as expected). In DBlog, I see however two warnings after editing and/or saving content with a Paragraphs field:
|
Sounds like we're close here with just a few rough edges turned up by @olafgrabienski -- thanks for your work on this @herbdool and @olafgrabienski! I can do a round of testing after @herbdool sees and responds to the latest findings. |
@olafgrabienski do you see the same errors without the patch? |
Yes, I do. (Sorry for not checking before.) No idea about the reason, though. There are some contrib modules on the test site, but not many:
|
@laryn sounds like those errors are not due to this PR. |
@herbdool Okay, I'll try to review this soon. |
I've just noticed that the node edit PREVIEW button does not seem to be working with my paragraphs.
Is this is known limitation of Paragraphs (if so, is it documented anywhere for folks like me to find) or is this a bug?
Or am I just doing something wrong.
The text was updated successfully, but these errors were encountered: