workflow_search_api.module in Workflow 7.2
Same filename and directory in other branches
Adds workflow state information to Search API index.
This is only valid for Workflow Node, not Workflow Field.
File
workflow_search_api/workflow_search_api.moduleView source
<?php
/**
* @file
* Adds workflow state information to Search API index.
*
* This is only valid for Workflow Node, not Workflow Field.
*/
/**
* Implements hook_entity_property_info_alter().
*/
function workflow_search_api_entity_property_info_alter(&$info) {
$info['node']['properties']['workflow_state_name'] = array(
'type' => 'text',
'label' => t('Workflow state label'),
'sanitized' => TRUE,
'getter callback' => 'workflow_search_api_property_workflow_state_getter_callback',
);
}
/**
* Getter callback for workflow state defined in workflow_search_api_entity_property_info_alter.
*/
function workflow_search_api_property_workflow_state_getter_callback($node) {
// Get text value of workflow state. Only for Workflow Node.
$field_name = '';
// An explicit var is needed.
$sid = workflow_node_current_state($node, 'node', $field_name);
return workflow_get_sid_label($sid);
}
Functions
Name![]() |
Description |
---|---|
workflow_search_api_entity_property_info_alter | Implements hook_entity_property_info_alter(). |
workflow_search_api_property_workflow_state_getter_callback | Getter callback for workflow state defined in workflow_search_api_entity_property_info_alter. |