I have created custom content type for upload the details. I have used hook_form_alter to set the node title as "Upload". When I edit the node in node/%/edit the title remains "Upload". I want the title to be "Edit" .How to do this?

  • Could you please paste your alter code? And I didn't get where you want the "Upload" title? you want this title to be seen just in create form? Jul 21, 2015 at 7:57

3 Answers 3


Please try this:

function hook_form_alter(&$form, &$form_state, $form_id) {
   if($form_id == 'form-id') {
   if(arg(0) == 'node' && arg(2) == 'edit'){
     drupal_set_title('Upload Edit');
     drupal_set_title('Upload'); }

  • Which form ID would you check to be sure it's the node edit form being shown?
    – apaderno
    Jul 21, 2015 at 12:28

After searching finally found the answer. Place this code in your template.php

if (!empty($variables['page']['content']['system_main']['#form_id']) && $variables['page']['content']['system_main']['#form_id'] == 'YOUR FORM ID') {
  if (arg(0) == 'node' && arg(1) == 'edit') {
    drupal_set_title(t('Edit Content');
  else {
    drupal_set_title("Upload Content");

Try this..

$node = node_load(your nid);
$node->title = 'new title';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.