Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
search.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2009 at 12:08 UTC
Updated:
29 Jul 2014 at 18:22 UTC
Instead of showing the last modified date, I need to display the publish date of nodes in the search results.
This article shows how to solve this in D5, but it seems that theme_search_item() isn't availiable anymore in D6.
Any ideas how to get this working?
Comments
Comment #1
BarisW commentedAnyone?
Comment #2
jhodgdonIn Drupal 6, you can use http://api.drupal.org/api/drupal/modules--search--search-result.tpl.php/6 and override that.
Comment #3
BarisW commentedNo you cannot. $info_split only contains the last modified date, not the created date.
Comment #4
jhodgdonAh, you are correct. In that case, it's a feature request. Drupal 6/7 are not taking feature requests at this time (only bug fixes), so I'll add it to the list for Drupal 8.
Comment #5
jhodgdonOne other note. You could do this with a very small module, using hook_search_result() to add the information to the search result, and then in your theme, process it correctly in the preprocess_search_result function.
Comment #6
glowrocks commentedBased on the great work done by Aaron at the Roving Coder, I've put together a solution for this that involves using the $result variable in the search-result.tpl.php file (which along with search-results.tpl.php has been copied to your theme directory).
http://www.allthepages.org/d6/archives/2010/07/drupal-display-creation-d...
Comment #7
jhodgdonIn drupal 7/8 we have
hook_node_search_result()
https://api.drupal.org/api/drupal/core!modules!node!node.api.php/functio...
which allows a module to add information to be displayed in a search result, and we have search-result.tpl.php or search-result.html.twig, which your theme can override (or the preprocess function) to make that information displayed the way you want it. So this essentially exists, and does not need to be added to core.