Closed (duplicate)
Project:
Add Another
Version:
6.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Dec 2011 at 20:49 UTC
Updated:
21 Mar 2012 at 14:48 UTC
Just wondering if it would be possible to allow the 'Add another %type' message to be editable per content type? Even giving it theme possibilities would be helpful. I have currently patched the module file itself to check for a certain content type to display different text after each node of that type has been saved.
$node_type = node_get_types('name', $node->type);
if ($node_type == 'Carpool') {
$_addanother_message = t('Add a <a href="@typeurl">%type</a> post for your return trip.', array(
'@typeurl' => url('node/add/'. str_replace('_', '-', $node->type)),
'%type' => node_get_types('name', $node) // would return value Carpool
));
}
else {
$_addanother_message = t('Add another <a href="@typeurl">%type</a>.', array(
'@typeurl' => url('node/add/'. str_replace('_', '-', $node->type)),
'%type' => node_get_types('name', $node)
));
}
In this situation if they wanted to have multiple postings they would choose a repeating date value associated with this content type. So I felt it nicer if the text was more descriptive about the next tasks available to the user.
Comments
Comment #1
robin monks commentedAlthough I would not be willing to further complicate the content type forms with additional fields (we already provide four checkboxes), you actually can override this message through your theme since
addanother_message_messageandaddanother_button_messageare theme functions.For information on overriding theme functions, check out the Beginners guide to overriding themable output.
If you need to change the message for all node types to be the same, you can also use the String Overrides module.
As a bonus, using either of these methods removes the need to custom patch Add Another. I'd recommend moving your existing solution into your theme to make upgrading to future versions of Add Another easier.
Comment #2
cybermache commentedHey Robin, thanks for the response. You're referencing how version 7.x functions, correct? Which is what I was looking for in version 6.x. I tagged this ticket with 6.x-1.x-dev because I did not see any theme_ functions within this module's files. I see
theme_addanother_message_messagein 7.x but not in 6.x. I've used String Overrides in the past but it didn't allow for my specificity and would not work in this instance.Can the structure of version 7.x be back ported to 6.x? That would certainly solve my issue and make this module theme-able for Drupal 6.x users. Would it be possible to do this without further complicating the content type forms.
Thanks
Comment #3
robin monks commentedThe module actually need substantial work to bring 6.x-1.x up to par with the work being done in 7.x-2.x; for the most part the 6.x version of this module could be considered minimally maintained. When the next release of 6.x does come around, I will work to get the messages within theme functions as they are in 7.x.
/Robin
Comment #4
robin monks commentedDuplicate of #1272316: Back port of 2.0 to Drupal 6