Active
Project:
Workflow-ng
Version:
5.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2007 at 19:37 UTC
Updated:
30 Oct 2007 at 19:39 UTC
using the doc
I'm trying to create a new action that send an email to every user in the selected role groups.
This is useful for workflow changes to alert editors that they have nodes to review.
but to start i'm trying to generate the form and can't get it to work
I someone can't help me start
thanks
here is the code that is note working
function mymodule_outil_action_info() {
return array(
'mymodule_outil_action_mail_to_role' => array(
'#label' => t('send a mail to a role'),
'#arguments' => array(
'user' => array('#entity' => 'user', '#label' => t('Recipient')),
),
'#module' => t('Token'),
'#description' => t('You may use the token replacements for the mail\'s message body as well as the mail\'s subject.'),
),
);
}
function mymodule_mail_to_role_form($settings = array(), $argument_info) {
$roles = user_roles();
unset($roles[1]); // good bye anonymous users!
//unset($roles[2]); // good bye authenticated users!
$form['recipients'] = array(
'#type' => 'checkboxes',
'#title' => t('Recipient Role Groups'),
'#default_value' => $edit['recipients'],
'#options' => $roles,
'#description' => t('Select which roles should receive this email.'),
);
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $edit['subject'],
'#size' => '20',
'#maxlength' => '254',
'#description' => t('The subject of the message.'),
);
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
'#default_value' => $edit['message'],
'#cols' => '80',
'#rows' => '20',
'#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body'),
);
workflow_ng_token_replacement_help($form, $argument_info);
return $form;
}
Comments
Comment #1
fagowith the function name mymodule_outil_action_info() your module has to be "mymodule_outil" - is this right?
then you have the action "'mymodule_outil_action_mail_to_role" specified, so you'll need the function name 'mymodule_outil_action_mail_to_role_form' for your form function