Currently search-result.tpl.php shows:

/* ...
 * Default keys within $info_split:
 * - $info_split['type']: Node type (or item type string supplied by module).
 * - $info_split['user']: Author of the node linked to users profile. Depends
 *   on permission.
 * - $info_split['date']: Last update of the node. Short formatted.
 * - $info_split['comment']: Number of comments output as "% comments", %
 *   being the count. Depends on comment.module.
 */

This was valid for Drupal 6 (http://api.drupal.org/api/drupal/modules!search!search.pages.inc/6):

  $info = array();
  if (!empty($result['type'])) {
    $info['type'] = check_plain($result['type']);
  }
  if (!empty($result['user'])) {
    $info['user'] = $result['user'];
  }
  if (!empty($result['date'])) {
    $info['date'] = format_date($result['date'], 'small');
  }
  if (isset($result['extra']) && is_array($result['extra'])) {
    $info = array_merge($info, $result['extra']);
  }

However, Drupal 7 does not have $info['type'], but does have $info['module'] (see http://api.drupal.org/api/drupal/modules!search!search.pages.inc/7):

  $info = array();
  if (!empty($result['module'])) {
    $info['module'] = check_plain($result['module']);
  }
  if (!empty($result['user'])) {
    $info['user'] = $result['user'];
  }
  if (!empty($result['date'])) {
    $info['date'] = format_date($result['date'], 'short');
  }
  if (isset($result['extra']) && is_array($result['extra'])) {
    $info = array_merge($info, $result['extra']);
  }

I'd write a patch, but I'm not particularly certain what $info['module'] is to be honest so wasn't sure what to put!

CommentFileSizeAuthor
#2 1517032-2.patch607 bytesdamiankloip
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rooby’s picture

This might be worth mentioning in the Converting 6.x modules to 7.x page too as I have seen a few of modules & themes around the place having errors in drupal 7 because they are expecting $info['type'] to be there.

damiankloip’s picture

Status: Active » Needs review
FileSize
607 bytes

Maybe something like this will suffice?

rooby’s picture

Sounds OK to me.

Pasqualle’s picture

Component: search.module » documentation
Category: task » bug
Priority: Minor » Normal
Status: Needs review » Reviewed & tested by the community
jhodgdon’s picture

Thanks! Yes, this patch was missed (there was not an actual maintainer for the Search module for quite a while there). This is fine. The documentation is also incorrect for 8.x, so technically we should fix it there first before doing a 7.x patch. However:
#1926344: Consolidate search-result.html.twig and search-results.html.twig
so I think we can just do this in 7.x.

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x. Thanks again!

jhodgdon’s picture

Issue summary: View changes

Making PHP syntax highlighting work better on the comment code

Status: Fixed » Closed (fixed)
Issue tags: +

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