You are here

function apachesolr_form_alter in Apache Solr Search 5.2

Same name and namespace in other branches
  1. 5 apachesolr.module \apachesolr_form_alter()

Implementation of hook_form_alter

File

./apachesolr.module, line 1596
Integration with the Apache Solr search application.

Code

function apachesolr_form_alter($form_id, &$form) {
  switch ($form_id) {

    /**
     * Wiping CCK fields mappings cache. We cannot invoke, as in D6, a hook
     * on fieldapi like we do in D6 with hook_content_fieldapi(), so we add a
     * new submit callback handler to CCK fields forms.
     */
    case '_content_admin_field':
    case '_content_admin_field_remove':
    case '_content_admin_field_add_existing':
    case '_content_admin_field_add_new':
      $form['#submit']['apachesolr_clear_cck_fields_cache'] = array();
      break;
    case 'block_admin_display_form':
      foreach ($form as $key => $block) {
        if (strpos($key, "apachesolr_mlt-") === 0 && $block['module']['#value'] == 'apachesolr') {
          $form[$key]['delete'] = array(
            '#value' => l(t('delete'), 'admin/settings/apachesolr/mlt/delete_block/' . $block['delta']['#value']),
          );
        }
      }
      break;
    case 'block_admin_configure':
      if ($form['module']['#value'] == 'apachesolr' && $form['delta']['#value'] != 'sort') {
        $form['block_settings']['title']['#access'] = FALSE;
      }
      break;
  }
}