Replaces Drupal's 'blue smurf' no search results text with the contents of a custom block. This allows content editors to easily substitute HTML for the 'blue smurf' text. There are other modules that replace the 'blue smurf' text, but this module is different b/c of the use of a block to allow HTML and easy editing by content editors.

Link to project page: http://drupal.org/sandbox/lindsayo/1510842
Link to repository: git clone --branch 6.x-1.x http://git.drupal.org/sandbox/lindsayo/1510842.git

For Drupal 6. D7 version soon.

Comments

jthorson’s picture

Just a note ... lindsayo is aware of (and understands) the 'minimum code' suggestion for an application, and would like this module evaluated for promotion separate from the 'create full projects' permission.

adammalone’s picture

Status: Needs review » Needs work

Just had a quick look through the code and a couple of things stand out to me:

  1. Since you're setting variables: variable_set('no_search_results_content', $edit['no_search_results_content']); you will need to include an install file for your module that deletes the variables upon module uninstall
    function custom_smurfs_uninstall() {
       variable_del('no_search_results_content');
    }
    
  2. On the same topic it might be useful to call your variable custom_smurfs_no_results or something with your module name in just to prevent confusion and overlapping variable names from potential other projects.
  3. Since you're including markup outside of your $title and $content have you considered using check_plain() instead of filter_xss_admin.
  4. More curious than anything but why the call to filter_form(2) to set the format. It strikes me as something that can be left off entirely, left as filter_form() (for default format) Someone more learned than me could probably answer my question, but, would filter_format(2) be the same on every drupal install?
  5. Good to see the automated code review produced nothing of note to report!
  6. It might be an idea to stick some default text in the 'view' case ie variable_get('no_search_results_content', t('No results')); just in case the site administrator forgets to set the content

There are a couple of points I've made that could be further discussed but certainly a few points to think about!

lindsayo’s picture

Thank you, typhonius for these very helpful suggestions. You taught me some stuff, I really appreciate it.

  1. Uninstall fixed.
  2. Variables renamed.
  3. I'm not sure about this, I think I need to use filter_xss of some kind b/c the whole point here is to be able to have custom HTML instead of the lame Blue Smurfs.
  4. See previous point. I need to put an Input Format here so the user can use HTML.
  5. Thanks! I ran it several times per jthorson's suggestion to find all the formatting kinks.
  6. Turns out I needed to set this just to get the variable_get() to work right. Thanks for the suggestion.

Thanks!

lindsayo’s picture

Status: Needs work » Needs review
lindsayo’s picture

Issue summary: View changes

Updated issue summary.

adammalone’s picture

Status: Needs review » Needs work

It's such a small thing to note, but you might want to change your repository address to git clone --branch 6.x-1.x http://git.drupal.org/sandbox/lindsayo/1510842.git as it's on the wrong branch at the moment and that could confuse people trying to grab it!

I've taken a look at your install file. Just wondering why you're deleting the custom_smurfs_no_results_content variable when you don't set it within the module?

I'd also perhaps suggest moving $block = variable_get('custom_smurfs_no_results'); to within the if statement. It is a very small thing but will stop drupal querying the variables database unnecessarily.

You raise a good point about using filter_xss_admin instead of check_plain and I'll have a think about if that is the best implementation. Alternatively someone else in the community may have an idea to weigh in with.

lindsayo’s picture

Status: Needs work » Postponed
klausi’s picture

Status: Postponed » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

klausi’s picture

Issue summary: View changes

Fixed the branch name.