In admin/content
page we have some update options. I want to execute a Php code only when I use publish selected content
or unpublished selected content
on that page.
This rules should be fired JUST when I publish/unpublished selected content
In admin/content
page we have some update options. I want to execute a Php code only when I use publish selected content
or unpublished selected content
on that page.
This rules should be fired JUST when I publish/unpublished selected content
You can use drupal's hook_form_alter()
for firing your PHP code. Check below example:
function contr_form_alter(&$form, &$form_state, $form_id) {
if($form_id == 'node_admin_content'){
$form['admin']['options']['submit']['#submit'][] = 'CUSTOM_SUBMIT_HANDLER';
}
}
and then you can write your PHP code in CUSTOM_SUBMIT_HANDLER function as below:
function CUSTOM_SUBMIT_HANDLER($form, $form_state){
if($form_state['values']['operation'] == 'publish'){
// Do your stuff when PUBLISH here.
}elseif ($form_state['values']['operation'] == 'unpublish') {
// Do your stuff when UNPUBLISH here.
}
}
You probably need to alter the action performed on publish or unpublish of the node.
Try using hook_action_info_alter to alter the existing actions.