Forked from
project / entity_workflow
74 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
entity_workflow.api.php 1.94 KiB
<?php
use Drupal\workflows\WorkflowInterface;
use Drupal\Core\Entity\EntityInterface;
/**
* @file
* Entity Workflow API documentation.
*/
/**
* @defgroup workflow_transition_hooks Workflow Transition Hooks
* @{
* For workflows that are attached to a fieldable entity type by using the
* 'entity_workflow_state' field type, two transition hooks are invoked,
* allowing modules to react before and after the transition has been performed.
* @}
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Allows altering the configuration of entity workflow plugins.
*
* @param array $configuration
* The configuration of the entity workflow plugin.
* @param string $plugin_id
* The entity workflow plugin ID.
*/
function hook_entity_workflow_type_alter(array &$configuration, $plugin_id) {
if ($plugin_id === 'entity_workflow_test_content') {
$configuration['default_transition_log'] = t('The entity has been edited in a workspace.');
}
}
/**
* Allows giving access to the entity workflow tab.
*
* @param bool $access
* Whether or not to provide access. Will be FALSE by default unless changed
* by an alter.
* @param \Drupal\workflows\WorkflowInterface $workflow
* The workflow configuration entity.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity.
*/
function hook_entity_workflow_has_bulk_workflow_alter(&$access, WorkflowInterface $workflow, EntityInterface $entity) {
$access = TRUE;
}
/**
* Returns a list of entities that should be presented on the bulk workflow tab.
*
* @param \Drupal\workflows\WorkflowInterface $workflow
* The workflow configuration entity.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity.
*
* @return array
* An array of entities. The key for each entity MUST be $entity_type . '--' .
* $entity_id.
*/
function hook_entity_workflow_bulk_workflow_entities(WorkflowInterface $workflow, EntityInterface $entity) {
return [];
}
/**
* @} End of "addtogroup hooks".
*/