Hi, I'm using some custom code to create ajax node edit pages. Also I have a rule that should fire when content is updated.
If I update the node using normal form rule is fired, when ajax form is submitted it does not.
I have an entry in logs that entity was updated, but no rule evaluation log.
The function looks like that:
function modal_raw_node_edit_node_page_edit($node, $js, $force_page_reload = FALSE) {
$type_name = node_type_get_name($node);
$title = $node->title;
$commands = array();
ctools_include('node.pages', 'node', '');
ctools_include('modal');
ctools_include('ajax');
$form_state = array(
'title' => $title,
'ajax' => TRUE,
'build_info' => array(
'args' => array($node),
'base_form_id' => 'node_form'
),
);
$form_id = $node->type . '_node_form';
$form_state += array(
're_render' => FALSE,
'no_redirect' => !empty($form_state['ajax']),
);
$form = drupal_build_form($form_id, $form_state);
if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) {
if (is_array($form)) {
$output = drupal_render($form);
}
$commands = array();
// If the form has not yet been rendered, render it.
$commands[] = array(
'command' => 'customer_form_display',
'output' => $output,
);
}
if (!empty($form_state['executed']) && empty($form_state['rebuild'])) {
// overwrite commands.
$commands = array();
ctools_add_js('ajax-responder');
$commands[] = ctools_modal_command_dismiss();
}
print ajax_render($commands);
exit;
}
I've tried including rules files but nothing helped. It's actually weird because I thought that "After updating existing content" event does not have anything to do with how the update was triggered. Any information would be helpful.
Comments
Comment #1
karolrybak commentedComment #2
tr commentedUpdating the node should fire the Rule event, no matter how the node is updated, since the Rule event is generated by hook_node_update(). The only exception would be if that hook isn't invoked for some reason. You can quickly test that with some custom code to see if your custom hook_node_update() is called.
If you're still having this problem with the current version of Rules feel free to reopen this issue with the results of your hook and a (simplified) export of your Rule so we can try to reproduce the problem.