Posted by glennnz on November 17, 2009 at 10:28am
I'm looking for a way to add a button to the end of a node that actually does something.
Rendering the button is easy:
<?php
function button_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'view':
$node->content['button'] = array(
'#type' => 'button',
'#value' => t('A Button!'),
);
break;
}
}
?>
The hard part is getting the button to DO something!
....
Glenn
Comments
Button Field!
Check out the Button Field module, and also have a look at the fantastic Rules module.
//Johan Falk, NodeOne, Sweden
**
Vill du lära dig mer om Drupal? Kolla in samlingen av tips och guider!
Har du en fråga om Drupal? Missa inte FAQ-sidan på forumet!
Kolla in min senaste guide: Hundra småsteg för att självlära sig Drupal 6
Try this
Off the top of my head:
<?php
function button_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'view':
$node->content['button'] = array(
'#type' => 'button',
'#value' => t('A Button!'),
'#attributes' => array('onClick' => 'alert("Hey, I do something!");');
);
break;
}
}
?>
similar question....
could you take a look at this comment and suggest something...
http://drupal.org/node/1275442
but I would want the button to appear on the node.
not in a view.