Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As figured out in #1957346: Add some settings on the block display to allow overrides on the block instance configuration the default value of use_more_always should be TRUE,
as this saves a full count query (similar to pager queries).
Comment | File | Size | Author |
---|---|---|---|
#7 | drupal-views-change_use_more_always_default-2046531-7.patch | 1.43 KB | olli |
#1 | drupal-views-change_use_more_always_default-2046531-1.patch | 625 bytes | DuaelFr |
Comments
Comment #1
DuaelFrThis issue was covered during the first Drupal Sprint of Montpellier (France).
Comment #2
dawehnerMaybe we should make a small test as well.
Comment #3
dawehnerAdd tag
Comment #4
dawehnerAdd tag
Comment #5
lokapujyaTrying to understand what test is needed.
But, I have a question: in the defaults array:
protected function defineOptions() {
$options = array(
'defaults' => array(
Comments Say "The $options array is An array which describes the options of a plugin. Each element is an associative array containing: - default: The default value of one option"
So, why would the defaults array contain a different default value than is set for option's default?
Comment #6
dawehnerThe 'defaults' subarray is used to determine whether a certain option should be marked as overridden right from the beginning when you add a new display, so you never can really change the value provided by the master/default display.
Comment #6.0
lokapujyaUpdated issue summary.
Comment #7
olli CreditAttribution: olli commentedHere's a small test.
Comment #8
dawehnerI like the test!
Comment #9
lokapujyaShould the test also verify that "Use more always" works when the view is placed in a block layout?
Comment #10
webchickI had a similar question to lokapujya about the test, but dawehner pointed out in IRC that the remainder of https://api.drupal.org/api/drupal/core!modules!views!lib!Drupal!views!Te... does test other aspects of the link, including whether it's output correctly when placed as content on a page.
I got confused while testing this, because I didn't realize that "use more always" was a separate setting from the "use more" setting to actually put a link to the page display on a block. So what this patch does is IF "use more link" is checked on a block display, it will then *always* show the "more" link in the block, even if there are < the total # of things per page. I think that is a bit of a regression in usability in a minority of cases (we're kind of lying to the viewer by saying "there's other stuff you're not seeing here" and in fact there is not), but in the vast majority where the number of total things is > the number of things shown in the block, it will indeed be a performance boost, and more render cache-friendly as well (as dawehner pointed out in IRC). And people who are hitting the usability issue can always uncheck the checkbox to conditionally display it, if their users are complaining about it.
So... Committed and pushed to 8.x. Thanks!
Comment #11
dawehnerThank you, that was quite a bit of "work" for a single line change ;)