function _workflow_info_field in Workflow 7.2
A wrapper around field_info_field.
This is to hide implementation details of workflow_node.
Parameters
string $field_name: The name of a Workflow Field. Can be empty if fetching Workflow Node.
Workflow $workflow: Workflow object. Can be NULL. For a workflow_field, no $workflow is needed, since info is in field itself. For a workflow_node, $workflow provides additional data in return.
Return value
array Field info structure. Pseudo data for workflow_node.
11 calls to _workflow_info_field()
- workflownode_node_delete in workflow_node/
workflownode.module - Implements hook_node_delete().
- workflownode_node_view in workflow_node/
workflownode.module - Implements hook_node_view().
- WorkflowTransition::execute in includes/
Entity/ WorkflowTransition.php - Execute a transition (change state of a node).
- WorkflowTransitionForm::buildForm in includes/
Form/ WorkflowTransitionForm.php - _state
- workflow_block_view in ./
workflow.block.inc - Implements hook_block_view().
File
- ./
workflow.module, line 1141 - Support workflows made up of arbitrary states.
Code
function _workflow_info_field($field_name, $workflow = NULL) {
// @todo D8: remove this function when we only use workflow_field.
$field = array();
if ($field_name) {
$field = field_info_field($field_name);
}
else {
$field['field_name'] = '';
$field['id'] = 0;
$field['settings']['wid'] = 0;
$field['settings']['widget'] = array();
if ($workflow != NULL) {
// $field['settings']['wid'] can be both: numeric or named.
$field['settings']['wid'] = $workflow->wid;
// @todo: to make this exportable: use machine_name??
$field['settings']['widget'] = $workflow->options;
$field['settings']['history']['roles'] = $workflow->tab_roles;
$field['settings']['history']['history_tab_show'] = TRUE;
// @todo: add a setting for this in workflow_node.
}
// Add default values.
$field['settings']['widget'] += array(
'name_as_title' => TRUE,
'fieldset' => 0,
'options' => 'radios',
'schedule' => TRUE,
'schedule_timezone' => TRUE,
'comment_log_node' => TRUE,
'comment_log_tab' => TRUE,
'watchdog_log' => TRUE,
'history_tab_show' => TRUE,
);
}
return $field;
}