Problem/Motivation

As a great man said :
<dawehner> DuaelFr: this always confused me, but I am biased as the code is in my brain

From an user point of views, the fact is that "Display 'more' link only if there is more content" is not really natural to understand and its description does not help a lot.
From a developper point of view, '#default_value' => !$this->getOption('use_more_always'), looks like a double negation.

In each case, this can lead to a lot of confusion.

Proposed resolution

Change title to "Always display the 'more' link"
Change the description to "Check this to display the 'more' link even if there are no more items to display."
Change the default value handling to remove the negation
Change the option save to remove the negation

User interface changes

Invert the use_more_always checkbox. It will have to be checked for the option to be active.

Credit

This issue was covered during the first Drupal Sprint of Montpellier (France).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr’s picture

Assigned: DuaelFr » Unassigned
Status: Active » Needs review
FileSize
1.72 KB

Here is the patch !

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -1445,9 +1445,9 @@ public function buildOptionsForm(&$form, &$form_state) {
+          '#description' => t("Check this to display the 'more' link even if there are no more items to display."),

Let's use single-quotes.

We needed this fix as we haven't been allowed to change the behavior: #1102974: Performance fix: Make "always display more link" the default if "create more link" is selected

DuaelFr’s picture

@dawehner Do you want me to put single-quotes around all occurences of "more" in the related fields titles and descriptions ?

dawehner’s picture

I re-RTBC it, because it is actually right to use double quotes here.

DuaelFr’s picture

You did not answer my question.

We have :

$form['use_more']['#title'] = t('Create more link');
$form['use_more']['#description'] = t("This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' section under advanced. You can override the url at the link display setting.");

$form['use_more_always']['#title'] = t("Display 'more' link only if there is more content");
$form['use_more_always']['#description'] = t("Leave this unchecked to display the 'more' link even if there are no more items to display.");

$form['use_more_text']['#title'] = t('More link text');
$form['use_more_text']['#description'] = t("The text to display for the more link.");

Two fields are using more without single-quotes and one is using 'more' with single-quotes.
Do you want me to harmonize this ? With or without single-quotes around "more" ?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -1445,9 +1445,9 @@ public function buildOptionsForm(&$form, &$form_state) {
+          '#title' => t("Always display the 'more' link"),
+          '#description' => t("Check this to display the 'more' link even if there are no more items to display."),

Let's remove the single quotes so that this is consistent with the other parts of the views ui. As we are changing this text here I don't think this is out of scope.

DuaelFr’s picture

Assigned: Unassigned » DuaelFr

I'll do it on monday.

DuaelFr’s picture

Assigned: DuaelFr » Unassigned
Status: Needs work » Needs review
FileSize
1.72 KB

As promised.

dawehner’s picture

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -1445,9 +1445,9 @@ public function buildOptionsForm(&$form, &$form_state) {
+          '#title' => t("Always display the more link"),
+          '#description' => t("Check this to display the more link even if there are no more items to display."),

If we remove the single quotes we can reintroduce single quotes again!

DuaelFr’s picture

I also single-quote'd the use_more_text description

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great!

alexpott’s picture

Title: Improve "use_more_always" understandability » Change notice: Improve "use_more_always" understandability
Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 8.x-3.x-dev
Component: views.module » Code
Issue tags: +Needs change record

Committed 74cbf95 and pushed to 8.x. Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Active

Setting to the correct status

dawehner’s picture

Status: Active » Fixed

The actual stored value did not change. I don't think that a UI change is worth of a change notice.

Automatically closed -- issue fixed for 2 weeks with no activity.