Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the Node Creation Title in Drupal?

Let's say I have a node called "product". When I create such a node, it will always display: "Create product" as the title of the node. How do I change this title WHEN CREATING THE NODE?

like image 267
coderama Avatar asked Aug 29 '26 02:08

coderama


1 Answers

you mean you have a content type "product"?

the "Create product" title when creating a node of type "product" is set in node_add($type):

// ...
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));
$output = drupal_get_form($type .'_node_form', $node);
// ...

there are at least 2 options to change this:

  • change the translatable string 'Create @name' (indicated by the t() it is passed through) via
    • settings.php - search for locale_custom_strings_, or
    • http://drupal.org/project/stringoverrides
  • modify the 'product_node_form' as mentioned by gpilotino (minus the $form['title']['#title'] = 'foobar' - you only need the drupal_set_title('foobar')). this is a little harder, as you have to write your own module.
like image 157
ax. Avatar answered Sep 03 '26 05:09

ax.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!