Problem/Motivation

As part of #2353867: [META] Expose Title and other base fields in Manage Display we are planning to remove special handling of the node date/user display and instead use normal "Manage Display" settings. As part of this process we would expect to remove the display_submitted setting from the node type along with related functions displaySubmitted(), setDisplaySubmitted(). These would all have no purpose once normal Manage Display is in use.

However there is a residual usage of the display settings - it controls the output of node search results. The search results are not affected by manage display settings, but instead come from a separate template search-result.html.twig. See NodeSearch::prepareResults() which calls if ($type->displaySubmitted()). In the case that the special above handling has been disabled, we need to remove the dependency on the display_submitted setting.

Steps to reproduce

  1. Install Drupal.
  2. Install the Manage Display module.
  3. Visit /admin/config/search/pages/manage/node_search and make a search that has some results.
  4. The search results might or might not contain date/user information, however this cannot be controlled without using the deprecated node setting.

Proposed resolution

1) If the special node display processing has been disabled, by setting the additional entity type property enable_base_field_custom_preprocess_skipping using hook_entity_type_build(), then NodeSearch::prepareResults() should add the user/date fields unconditionally, without calling displaySubmitted().

2) Maybe provide a new setting to control formatting of results. For example, it could be added to /admin/config/search/pages/manage/node_search? Or we could rely on sites editing the template to control the results? Or we could create a new node view mode and use that to display search results if it exists?

Remaining tasks

Decide how to handle backward-compatibility. Maybe we need a new setting that controls whether to print the search results the old way or the new way??

User interface changes

See proposed resolution.

API changes

None

Data model changes

None

Issue fork drupal-3392273

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BeauTownsend created an issue. See original summary.

bbox1’s picture

Issue summary: View changes
bbox1’s picture

Status: Active » Needs work

astonvictor made their first commit to this issue’s fork.

astonvictor’s picture

Status: Needs work » Needs review

Hi there,

I was able to reproduce it. I had different search results on the /search/node page.

I'm not sure why we should hide the setting on the node edit page because it's possible to have different settings for different node types after enabling the module.

e.g. article has enabled setting and page has disabled setting. after enabling the module, both settings will have the same (and different) values.

I prepared a simple MR to remove the form alter.

thanks a lot

adamps changed the visibility of the branch 3392273-cannot-toggle-display to hidden.

adamps’s picture

Status: Needs review » Postponed (maintainer needs more info)

We should not just remove this code - it is there for a reason😃!

the Display settings vertical tab is no longer displayed on content type edit pages

This is working as designed. The hidden setting has no effect with this module. Instead the submitted display is controlled using manage display settings.

The "steps to reproduce" is missing essential information. What do I need to do to see the problem? If there is a problem relating to search then please describe what search to do.

astonvictor’s picture

Status: Postponed (maintainer needs more info) » Needs review

You should just visit /search/node page that shows a few results. Then you should toggle the 'Display author and date information' config and compare it with the previous output.

The search module uses its own templates (search-result.html.twig) for rendering results. So, the output actually depends on the submitted config of the node type.

adamps’s picture

Thanks, I see it now.

The long term goal of this module is that display_submitted will be removed from Core in NodeTypeForm, node.schema.yml, and NodeTypeInterface::displaySubmitted(), setDisplaySubmitted(). The setting has no effect once the display of submitted is controlled by manage display settings like other fields.

So control of the search output will need to be done in a different way. Maybe it could be added to /admin/config/search/pages/manage/node_search?

adamps’s picture

Title: Cannot toggle display settings for core search results » Provide an alternate way to control display settings for node search results
Project: Manage display » Drupal core
Version: 3.0.0 » 11.1.x-dev
Component: Code » node system
Category: Bug report » Feature request
Issue summary: View changes
Status: Needs review » Active
adamps’s picture

Issue summary: View changes
quietone’s picture

Version: 11.1.x-dev » 11.x-dev

Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

astonvictor’s picture

Status: Active » Needs review

> The long term goal of this module is that display_submitted will be removed from Core in NodeTypeForm, node.schema.yml, and NodeTypeInterface::displaySubmitted(), setDisplaySubmitted()

I finished that part by removing all calls to the display_submitted property.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

astonvictor’s picture

Status: Needs work » Needs review

The pipeline contains some Schema key node.type.article:display_submitted failed with: missing schema errors.
As I can see, the display_submitted was removed from all places. I guess it tries to compare it with the previous version that still contains data.

Is it possible somehow to e.g. skip the validation?

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new98 bytes

The Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.