hook

Making a custom block with an admin settings form in a Drupal module

Often while building a Drupal website, you'll need to create a custom Block containing HTML and content. Completely standard right? It's a problem when your client or the site maintainer needs to change some of that content. They are forced to wade through significant amounts of HTML to find that little bit of content to update. Instead, why don't you build a custom settings page? Your site maintainer gets a simple form to update and you get variables to output.

Add a total number of results to ApacheSolr result pages

By default the Drupal ApacheSolr module does not display the total number of results for a given search. This is how to add it.

For my use it makes sense to add the result total to the Search form using hook_form_[form_id]_alter().


/**
* Implementation of hook_form_[form_id]_alter().
*/
function ms_solr_site_form_search_form_alter(&$form, &$form_state) {
if ($form['module']['#value'] == 'apachesolr_search') { //Will change all searches otherwise.
if (apachesolr_has_searched() && ($response = apachesolr_static_response_cache())) {

Subscribe to hook