Closed (won't fix)
Project:
Send
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Jul 2006 at 18:00 UTC
Updated:
10 Dec 2006 at 00:58 UTC
Hi-
I wanted the option of having a help link on the links that send modules create. I added this code to send.inc in _send_settings_form()
$form['send_link_settings'] = array(
'#type' => 'fieldset',
'#title' => 'Link settings',
);
$form['send_link_settings']["{$module}{$type}_linktext"] = array(
'#type' => 'textfield',
'#title' => t("Link text"),
'#default_value' => _send_value('linktext', $module, $nodetype, $node),
'#size' => 30,
'#maxsize' => 100,
'#description' => t('Leave blank to suppress link'),
);
$form['send_link_settings']["{$module}{$type}_linktext_help_display"] = array(
'#type' => 'checkbox',
'#title' => t('Display help link.'),
'#default_value' => _send_value('linktext_help_display', $module, $nodetype, $node),
'#description' => t('When this is enabled, the text below will be displayed in line with the link.'),
);
$form['send_link_settings']["{$module}{$type}_linktext_help_text"] = array(
'#type' => 'textarea',
'#title' => t('Guest pass help text'),
'#default_value' => _send_value('linktext_help_text', $module, $nodetype, $node ),
'#description' => t("This text is appended to the link on pages where it is displayed."),
);
in send.module, in function send_link(), i modified the function to look like this:
function send_link($type, $node=null) {
if (!$node) return;
foreach(_send_modules() as $m) {
$on = variable_get("{$m}_{$node->type}", 0) && module_invoke($m, 'send', 'access', $m);
if ($on && $linktext = _send_value('linktext', $m, $node->type, $node)) {
// check if there is help text, if so, append it to the link
if (_send_value('linktext_help_display', $m, $node->type, $node)) {
$append = _send_value('linktext_help_text', $m, $node->type, $node);
} else { $append = null; }
$links[] = l($linktext, "send/{$m}/{$node->nid}", array("class" => 'send-link send-'.$m) ) . $append;
}
}
return $links;
}
Comments
Comment #1
allie mickaYou can do this in a separate module using hook_form_alter and hook_links.
It's a good idea too - maybe you could write something more all-purpose for help links beyond send functionality.