Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using state_flow and Search API. When i try to publish node through node/%/revisions/%/workflow/publish the node successfully published but search API index is not updated. Search API relies on entity_update hook but it is not fired from state_flow.
It can be done in the same way as taxonomy integration implemented:
taxonomy_build_node_index($node);
in the set_published method().
And add code to call re-indexing node in Search API:
if (module_exists('search_api')) {
search_api_track_item_change('node', array($node->nid));
}
As a temporary solution anybody can implement hook_state_flow_event_fired in own module and make the same:
function MYMODULE_state_flow_event_fired($node, $event_key, $uid, $log) {
// Rebuild index for this node
if (module_exists('search_api')) {
if ($event_key == 'publish') {
search_api_track_item_change('node', array($node->nid));
}
}
}
Comments
Comment #1
fmitchell CreditAttribution: fmitchell commentedThanks for catching this. I'll assign to myself.
Comment #2
fmitchell CreditAttribution: fmitchell commentedhttp://drupalcode.org/project/state_machine.git/commit/67c4728