Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a very useful module! I've had a few cases where we want to use the Search 404 functionality, but also need to include other content on the 404 page. Most recently this also included having the search results in the middle of some other content. To achieve this, I created a block for the Search 404 module that provides the search results.
To keep the block the same as the search results page, I refactored two small parts of the existing module:
- Part of
search404_page()
was extracted into a new functionsearch404_results()
that is now used by the page and the block. - Another part of
search404_page()
was extracted into another function,search404_get_default_search()
, for use in the page and the block.
I hope this will make a useful addition to this module. Thanks!
Comment | File | Size | Author |
---|---|---|---|
#7 | add_a_block_for_search-1719292-7.patch | 5.21 KB | glen.pinheiro |
Comments
Comment #1
anish_zyxware CreditAttribution: anish_zyxware at Zyxware Technologies commentedThis has to be updated according to newest code.
Comment #2
glen.pinheiro CreditAttribution: glen.pinheiro commentedComment #3
glen.pinheiro CreditAttribution: glen.pinheiro commentedThe patch file has now updated to the latest code.
Comment #4
anish.a CreditAttribution: anish.a at Zyxware Technologies commentedThe code for set message is called in 3 places. It can be using the latest message function,
search404_error_message()
drupal_set_message(t('The page you requested does not exist. For your convenience, a search was performed using the query %keys.', array('%keys' => check_plain($keys))), 'error');
Comment #5
glen.pinheiro CreditAttribution: glen.pinheiro commentedUpdated the set message calls with 'search404_error_message()' function.
Comment #6
glen.pinheiro CreditAttribution: glen.pinheiro commentedComment #7
glen.pinheiro CreditAttribution: glen.pinheiro commentedUpdated the patch with latest code.
Comment #8
anish_zyxware CreditAttribution: anish_zyxware at Zyxware Technologies commentedReviewed. Finally, it works fine.
Comment #9
anish_zyxware CreditAttribution: anish_zyxware at Zyxware Technologies commented