While working on an override of the search form, I discovered that commons_core_form_search_theme_form_alter() is called twice. Once directly and once by commons_core_form_alter(). In the latter all commons_core_form_* alter functions are called (again). It took some serious debugging to find this out and I like to prevent others from running into this situation. I don't understand the deeper reason behind this construction, but I propose to remove the following from commons_core_form_alter():

  // Invoke our own form ID hooks
  else {
    $hook = "commons_core_form_{$form_id}_alter";
    if (function_exists($hook)) {
      $hook($form, $form_state);
    }

Comments

ezra-g’s picture

Component: Code » Search