10:35 14/12/2006

Drupal - Personnaliser le bloc de recherche

le code suivant :
- désactive le bouton "Submit" du bloc de recherche. La recherche est donc tout simplement validee par la touche entree.
- applique la valeur "rechercher ..." au champ de recherche afin d'indiquer un peu a quoi sert ce formulaire.
- remet cet valeur a zero lorsque le champ est selectionné.

Cela donne le "plus-simple-tu-meurs" bloc de recherche en haut a droit de cette page.

code : template.php

function template_search_block_form($form) {
$form['search_block_form_keys']['#attributes'] = 
 array(
  'onselect' => value='\'\'',
  'onclick' => value='\'\''
 );
$form['search_block_form_keys']['#value'] = 
   'rechercher ...';
$form['submit']['#type'] = 'hidden';
$output = form_render($form);
return $output;
}

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Images can be added to this post.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options