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
- Install Drupal.
- Install the Manage Display module.
- Visit /admin/config/search/pages/manage/node_search and make a search that has some results.
- 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
| Comment | File | Size | Author |
|---|
Issue fork drupal-3392273
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:
Issue fork manage_display-3392273
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:
- 3392273-cannot-toggle-display
changes, plain diff MR !24
Comments
Comment #2
bbox1 commentedComment #3
bbox1 commentedComment #6
astonvictor commentedHi there,
I was able to reproduce it. I had different search results on the
/search/nodepage.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
Comment #8
adamps commentedWe should not just remove this code - it is there for a reason😃!
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.
Comment #9
astonvictor commentedYou should just visit
/search/nodepage 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.Comment #10
adamps commentedThanks, I see it now.
The long term goal of this module is that
display_submittedwill be removed from Core in NodeTypeForm, node.schema.yml, andNodeTypeInterface::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?
Comment #11
adamps commentedComment #12
adamps commentedComment #13
quietone commentedChanges are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.
Comment #17
astonvictor commented> 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.
Comment #18
needs-review-queue-bot commentedThe 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.
Comment #19
astonvictor commentedThe pipeline contains some
Schema key node.type.article:display_submitted failed with: missing schemaerrors.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?
Comment #20
needs-review-queue-bot commentedThe 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.