function processContent($taskid, $op, $object) { $node = $object; // For this task type, the object passed in, is the node object. $rec = db_select('maestro_queue')->fields('maestro_queue', array('process_id', 'template_data_id'))->condition('id', $node->maestro_taskid, '=')->execute()->fetchObject(); if ($node->status == 1) { $status = MaestroContentStatusCodes::STATUS_PUBLISHED; } else { $status = 0; } $tracking_id = db_select('maestro_process')->fields('maestro_process', array('tracking_id'))->condition('id', $rec->process_id, '=')->execute()->fetchField(); if ($op == 'insert') { db_insert('maestro_project_content')->fields(array('nid' => $node->nid, 'tracking_id' => $tracking_id, 'task_id' => $taskid, 'content_type' => $node->type, 'status' => $status))->execute(); // Initiate the mestro workflow engine and complete the task // Complete task is an engine method $maestro = Maestro::createMaestroObject(1); $maestro->engine()->completeTask($taskid); } }