/**
how to write our own action. this action have those functions.
1. tell the drupal. this action support which trigger
2. creat a action function
*/
//action_info is the hook's name
//system mean can use everywhere
//configuration mean whether we can get the paramter from another places
function beep_action_info(){
$info['beep_beep_action']= array(
'type'=>'system',
'description'=>'t("Beep"),
'configurable'=>FALSE,
'hooks' => array(
'nodeapi' => array('view', 'insert', 'update', 'delete'),
'comment' => array('view', 'insert', 'update', 'delete'),
'user' => array('view', 'insert', 'update', 'delete', 'login'),
'taxonomy' => array('insert', 'update', 'delete'),
);
return $info;
}
//this mean this action can use any hooks
function beep_action_info(){
$info['beep_beep_action']= array(
'type'=>'system',
'description'=>'t("Beep"),
'configurable'=>FALSE,
'hooks' => array(
'any'=>TRUE
);
return $info;
}
// create a form that can store many time
function beep_multiple_beep_action_form($context) {
$form['beeps'] = array(
'#type' => 'textfield',
'#title' => t('Number of beeps'),
'#description' => t('Enter the number of times to beep when this action executes.'),
'#default_value' => isset($context['beeps']) ? $context['beeps'] : '1',
'#required' => TRUE,
);
return $form;
}
function beep_multiple_beep_action_validate($form, $form_state) {
$beeps = $form_state['values']['beeps'];
if (!is_numeric($beeps)) {
form_set_error('beeps', t('Please enter a numeric value.'));
}
else if ((int) $beeps > 10) {
form_set_error('beeps', t('That would be too annoying. Please choose fewer than 10 beeps.'));
}
}
function beep_multiple_beep_action_submit($form, $form_state) {
return array(
'beeps' => (int) $form_state['values']['beeps']
);
}
/**
* Configurable action. Beeps a specified number of times.
*/
function beep_multiple_beep_action($object, $context) {
for ($i = 1; $i < $context['beeps']; $i++) {
beep_beep();
}
}
分享到:
相关推荐
HOWTO-html<br>News-HOWTO-html<br>News-Leafsite-html<br>Oracle-HOWTO-html<br>Plug-and-Play-HOWTO-html<br>PPP-HOWTO-html<br>Printing-HOWTO-html<br>QT 3.3 中文白皮书.pdf Quota RCS-...
/TD> PCMCIA-HOWTO (39KB) 安装及使用 PCMCIA 卡服务程式 Plug-and-Play-HOWTO (12KB) 帮助你理解和使用 PnP 设备. PPP-HOWTO (53KB) 如何把你的 Linux PC 连接到一台 PPP 伺服器上. RPM-HOWTO (15...
However, to wrap subclassing and hooking into virtual function overriding it is an obscure technique unknown to a large population of Windows programmers. This is unfortunate, because there are many ...
How to Hook the Mouse to Catch Events Outside of your Delphi application.pdf
By the end of the book, you'll be able to use Express to build a Node app and know how to test it, hook it up to a database, and automate the dev process. What's Inside Simplify Node app setup ...
Create a 3D space combat simulator with projectile shooting and respawning objects, and learn how to manage the appearance of 3D models Dive into Unity’s advanced features, such as precomputed ...
npm install -g create-react-hook创建一个新的钩子create-react-hook 回答有关模块的一些基本提示,然后CLI将执行以下步骤: 复制模板通过yarn或npm安装依赖项将软件包链接在一起以进行本地开发初始化本地git回购...
hook VirtualProtect And VirtualAlloc
hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程hook 教程...
The LLDB command command regex acts much like command alias, except you can provide a regular expression for input which will be parsed and applied to the action part of the command. 10. Assembly ...
Express in Action is a carefully designed tutorial that teaches developers how to build web applications using Node and Express. It starts by introducing Node’s unique characteristics and then shows ...
You'll learn how to create an Android-friendly web app on the platform of your choice, and then convert it to a native Android app with the free PhoneGap framework. Discover why device-agnostic mobile...
You’ll learn how to create an Android-friendly web app on the platform of your choice, and then convert it to a native Android app with the free PhoneGap framework. Discover why device-agnostic ...
这个提示旨在帮助您创建一篇... Your task is now to teach me how to craft an engaging story about my product/service that highlights how it has helped a customer achieve their goals. To better understand
Device-agnostic mobile apps are the wave of the future, and this book shows you how to create one product for several platforms. You’ll find guidelines for converting your product into a native ...
Replace the WH_CALLWNDPROC hook (its behavior differs on Win9x and WinNt) with WH_GETMESSAGE. 2.. Make some other minor changes, such as replace the appropriate SendMessage with PostMessage, and so...
This book teaches you how to hook up your Raspberry Pi computer, install different games from a variety of genres, and set up emulators so you can play hundreds of classic arcade and console games....
该DEMO实现了:如何HOOK桌面窗口消息 How to hook desktop message?
含内核HOOK 的 easyhook,可用于C#等语言支持