This is a patch to fix issue reporte in #12 of #2491949: Pager missing.
In some cases, line 74 of views_pdf.install in version 1.6 of Views PDF results in display_options['pager'] = NULL;. This breaks the View.
This NULL value happens if the pdf display's display_options['pager']
was not previously set (that is, if the PDF view pager was untouched and was the same as the Master)
This patch checks to see if display_options['pager']
pager was previously set. If it was, then it adds a FALSE in the defaults to indicate that this display's pager is not the same as the Master. If it wasn't (i.e. the pdf display had the default pager), then it leaves everything intact, resulting in the default pager still being used in the pdf display after the update.
I've tested both scenarios before the database update: an untouched pager in the pdf display, and a pdf display with a modified original pager. Works fine.
Patch in the next comment
Comment | File | Size | Author |
---|---|---|---|
#6 | pager_update_fix-2491949-6.patch | 1.82 KB | argiepiano |
#2 | pager_update_fix-2491949-2.diff | 720 bytes | argiepiano |
Comments
Comment #2
argiepiano CreditAttribution: argiepiano as a volunteer commentedPatch attached
Comment #3
argiepiano CreditAttribution: argiepiano as a volunteer commentedComment #4
argiepiano CreditAttribution: argiepiano as a volunteer commentedComment #5
argiepiano CreditAttribution: argiepiano as a volunteer commentedThe issue is a bit more complex than this - we will need to provide a new hook_update_N since this fix will make it into the next version of the project.
And we will need to get rid of
function views_pdf_update_7000()
included in version 1.6 (BTW, "7000" is the wrong N - see hook_update_N).I'll work on a better patch tomorrow. Night night.
Comment #6
argiepiano CreditAttribution: argiepiano as a volunteer commentedI'm now attaching a patch that replaces the faulty function views_pdf_update_7000(). This patch should make it into version 7.x-1,7.
Here's an explanation of what the arrays views
display_options['pager']
anddisplay_options['defaults']
look like in each of the last versions of views_pdf.While this may be obvious for some, learning about these helped me create this patch. Hopefully I got it right!
In version 7.x-1.5
- When the pager of the PDF display is "untouched" (meaning that it's the default "Display a specified number of items | 10") the arrays
display_options['pager']
anddisplay_options['defaults']
are NOT set at all.- When user changes to the pdf pager to "Display all" items" (the only other option in version 1.5) the pdf display contains
display_options['pager']
but nodisplay_options['defaults']
array.In version 7.x-1.6
- After updating, if the PDF display pager was "untouched" before update,
display_options['pager']
is wrongly set to NULL (which breaks the display), anddisplay_options['defaults']['pager']
is set to FALSE- After updating, if the PDF display pager had been modified to "Display all items" before update,
display_options['pager']
left unchanged, anddisplay_options['defaults']['pager']
is set to FALSEWith the new patch (hopefully version 7.x-1.7)
- After updating, if the PDF display pager was "untouched" before update,
display_options['pager']
anddisplay_options['defaults']
are not added at all, resulting in a pager that matches the Master's- After updating, if the PDF display pager had been modified to something different from the Master, or to "Display all items" before update,
display_options['pager']
is left alone (it existed), and the update function checks to see ifdisplay_options['defaults']['pager']
anddisplay_options['defaults']['options']
existed. If they don't exist they are added with FALSE value to indicate the pager is different from the Master.Comment #8
vegansupreme CreditAttribution: vegansupreme commentedGreat job Argiepiano! Thanks for taking a deep look at this issue and figuring out and explaining exactly how the pager system works!
Comment #9
argiepiano CreditAttribution: argiepiano as a volunteer commented