Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By cabplan on
I would like to change the "Summary" title of the "Body" field element to "Excerpt" while you are editing a node. Can anyone tell me how to do that? Is it in the field.tpl.php? or somewhere else.
Comments
What type of node are you
What type of node are you trying to change?
For an article, you could go to Structure>Content Types>Article>Manage Fields>Body
And you could change the visible name.
tk
So I understand I can open up
So I understand I can open up the Body field of my "Website Page" content type but there is nowhere to edit the label called "Summary". When you click on "Edit Summary" it shows the Summary box but how do I change the "Summary" label to something else?
manage fields
you should see a pane called "label" that enables you to change the name.
[URL=http://s519.photobucket.com/user/unokubizukuri/media/bodyfield.jpg.html]...
I do see the "Label" field
I do see the "Label" field but that is for the main Body field not the Summary field that is associated with the "Text area with a summary" widget type. That widget gives the ability to click on the "Show Summary" which it then has a label saying "Summary". I think I can change this with a hook_form_alter but I have no idea how to target that element. Can anyone help me write a hook_form_alter that targets the Summary label?
Use a theme function
I found this page when trying to do the same. I also found the solution in this question in an answer to a similar but different question here:
http://drupal.stackexchange.com/questions/5624/renaming-the-label-of-the...
You need to to add a new function to your template.php file, which is found in your theme, and adjust it according to your requirements:
I provide Drupal, Drupal Commerce and CiviCRM development services for customers in New Zealand and beyond
Solution in form_alter
I think that what you're looking for is the following solution:
If you want to change the label according to the form, you can use the $form_id.
This will change the label in your edit form. However, it will keep the (Hide Summary) link.
I know it was asked long time ago, but perhaps can help someone else.