Changing a form page title programmatically


Changing a title for a form page with this snippet and that module is easy and fun.

Get raw version
  1. function your_module_form_alter(&$form, $form_state, $form_id) {
  2. switch ($form_id) {
  3. case "ct_name_1_node_form":
  4. drupal_set_title(t("Title you prefer 1"));
  5. break;
  6. case "ct_name_2_node_form":
  7. drupal_set_title(t("Title you prefer 2"));
  8. break;
  9. }
  10. }


jrohit's picture

Is this for node title or page title ? As drupal_set_title() will change the page title not node title. It also affects the metatag.