I needed to put a custom text above the search results 404. Or if can integrate the search in a block, so I put it below the display module custom error.

Thanks

Comments

revnoah’s picture

I had the same problem, plus I wanted to fix the page title. I ended up modifying search404.module. Not a preferred solution, but these should really be integrated into the module itself.

In search404_settings(), I added the following fields:

$form['advanced']['search404_page_title'] = array(
    '#type' => 'textfield',
  	'#title' => t('Page Title'),
    '#default_value' => variable_get('search404_page_title', false),
  );
  $form['advanced']['search404_page_text'] = array(
    '#type' => 'textarea',
  	'#title' => t('Page Text'),
    '#default_value' => variable_get('search404_page_text', false),
  );

In search404_page(), I removed

$output = '<p>'. t('The page you requested was not found.') .'</p>';

And added:

  drupal_set_title(t(variable_get('search404_page_title', false)));
  $output = variable_get('search404_page_text', false);
k74’s picture

I added a block with the text that I was interested in showing, this block is only displayed on the page search404

zyxware’s picture

Status: Active » Postponed (maintainer needs more info)

Hi k74

The solution provided by revnoah, should work, but what was the specific need that prompted the need for this?

If the feature is reusable and needed by other people, we could implement this in a future release.

Let me know if that is required.

Regards
Zyxware

wa2nlinux’s picture

Solution from K74 made simple but If we can add custom text on search404 it will be more simple. If we not found what looking for then we can add it, the text intructions to add is from custom text.

epersonae2’s picture

I would love to see an option to add custom text, ideally along with a custom page title.

wkmit’s picture

Just tried the solution by revnoah and it does work.
It's useful if you want a single generic message.

zyxware’s picture

Assigned: Unassigned » zyxware

Hi k74

After some consideration I have added this feature to search404 in the latest dev.

I have used revnoah, code with a little bit of change to be compatible with the current code base.

Regards
Santhosh Raju

zyxware’s picture

Status: Postponed (maintainer needs more info) » Needs review
zyxware’s picture

Status: Needs review » Fixed

Marking issue as fixed.

Status: Fixed » Closed (fixed)

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