How to change the text of "Add more values" button? I don't want to change the text from modules/cck/modules/content_multigroup/content_multigroup.node_form.inc.
I tried to print $form array in hook_form_alter() but can't find "Add more values" but the only thing similar that I see is "Add another item".
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | cck-theme_add_more_label_node-536260-15.patch | 1.73 KB | agileware |
| #5 | cck-536260-5.patch | 1.86 KB | agileware |
Comments
Comment #1
andreiashu commentedHey,
Try this: http://drupal.org/project/stringoverrides
Comment #2
markus_petrux commentedIn the CCK handbook:
- Code snippet: How to change the label of the "Add more items" button.
Comment #3
xn2001 commentedthx both of you (andreiashu and markus_petrux)!
Comment #5
agileware commentedHere is a patch that makes the button text themeable which would make the process much easier
seeing as you can't just form_alter it in the usual manner.
Comment #6
interestingaftermath commentedWhere do you theme this text?
Comment #7
agileware commentedYou can either do it in the manner suggested in #2, which is fairly complex just to theme some text on a button
OR
you apply the patch in #5 and then in your theme put this code in your template.php file
Then you just change the 'Add more values' part of that code snippet to be whatever text you want on the button.
Comment #8
interestingaftermath commentedThanks!
Any help you could be on http://drupal.org/node/156860 would be greatly appreciated. I really need that functionality and it looks like it's working for others.
Comment #9
karens commentedPatch applied. I agree this makes more sense.
Comment #10
tomsm commentedI want to change "Add more values" only for one multigroup field named "group_order_line". I added the following to my template.php:
The "Add more values" of other multigroup fields also changes.
How can I limit the change to one field or one content type?
I use Content Construction Kit (CCK) 6.x-3.0-alpha3
Comment #11
agileware commentedThe $group_name parameter of the theme function is the name of the group currently being themed,
so to just do that particular group you could do:
To do it for a particular content type you could do (or you could use the solution in #2):
You can also add the group name check from the first example in the second example to just do a single group from particular content type.
Comment #12
karens commentedMight be nice to pass the $node to the theme as well as the group name, as a second argument. If someone wants to make a patch for that we can make that change.
Comment #13
agileware commentedYeah, I was thinking that when I started having to do node loads in the template.php example above.
Will do when I get some time.
Comment #14
tomsm commented@Agileware
Thank you! #11 works great.
Comment #15
agileware commentedHere is a patch to pass the node into the theme function for easier themeing.
Comment #16
ezra-g commentedFwiw, this can be form_altered by targeting, for example, with a "field_presenters" user-reference field:
$form['field_presenters']['field_presenters_add_more']['#value'] = t('Add another presenter');
I'm not sure whether or not that satisfies the need provided by this patch.
Comment #17
ezra-g commentedAfter further thought, if we had a theme function to change every button's value/label, we'd have a ton of theme functions. hook_form_alter() is effectual here, and I think that eliminates the need for this patch.
Comment #18
agileware commented@ezra-g:
Also note that this issue is regarding the add more button for a CCK 3 multigroup, not just a single field's add more button.