function workflow_get_field_name in Workflow 8
Same name and namespace in other branches
- 7.2 workflow.module \workflow_get_field_name()
Determines the Workflow field_name of an entity. If an entity has multiple workflows, only returns the first one.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity at hand.
string $field_name: The field name. If given, will be passed as return value.
Return value
string The found Field name.
5 calls to workflow_get_field_name()
- WorkflowManager::getCurrentStateId in src/
Entity/ WorkflowManager.php - Gets the current state ID of a given entity.
- WorkflowManager::getPreviousStateId in src/
Entity/ WorkflowManager.php - Gets the previous state ID of a given entity.
- WorkflowStateActionBase::getTransitionForExecution in src/
Plugin/ Action/ WorkflowStateActionBase.php - WorkflowTransitionBlock::build in src/
Plugin/ Block/ WorkflowTransitionBlock.php - Builds and returns the renderable array for this block plugin.
- WorkflowTransitionListController::historyOverview in src/
Controller/ WorkflowTransitionListController.php - Shows a list of an entity's state transitions, but only if WorkflowHistoryAccess::access() allows it.
File
- ./
workflow.module, line 472 - Support workflows made up of arbitrary states.
Code
function workflow_get_field_name(EntityInterface $entity, $field_name = '') {
if (!$entity) {
// $entity may be empty on Entity Add page.
return '';
}
if ($field_name) {
return $field_name;
}
$fields = workflow_get_workflow_field_names($entity);
$field_name = reset($fields);
return $field_name;
}