Book Image

Learning Drupal 6 Module Development

By : Dries Buytaert, Matt Butcher
Book Image

Learning Drupal 6 Module Development

By: Dries Buytaert, Matt Butcher

Overview of this book

Table of Contents (14 chapters)
Learning Drupal 6 Module Development
Credits
About the Author
About the Reviewers
Preface

Completing the Action: Theming and Mailing


Returning to the sitenews_send_action() action we are defining in the sitenews module, let's continue with the line after the hook processing:

// Execute hook_sitenews()
$content = module_invoke_all('sitenews');
// Build params
$params = array(
'node' => $object,
'to' => implode(', ', $addresses),
'subject' => $object->title,
'context' => $context,
'additional content' => $content,
);
$message = _sitenews_do_message($object, $params);
watchdog(
'actions',
'Site News "Send" action fired. Sending to !mail',
array('!mail' => $params['to'])
);

Our call to module_invoke_all('sitenews') returns an array of content. Assuming that only the two hooks we created above were called, our returned array will contain an entry for philquotes_sitenews() and an entry for biography_sitenews().

Note

Of course, for the hook to be executed, the module containing the hook must also be installed and enabled. In practical terms, both the philquotes module...