public function WorkflowTransition::logError in Workflow 8
Generate a Watchdog error.
Parameters
$message:
$type: {'error' | 'notice'}
$from_sid:
$to_sid:
4 calls to WorkflowTransition::logError()
- WorkflowTransition::execute in src/
Entity/ WorkflowTransition.php - Execute a transition (change state of an entity).
- WorkflowTransition::executeAndUpdateEntity in src/
Entity/ WorkflowTransition.php - Executes a transition (change state of an entity), from OUTSIDE the entity.
- WorkflowTransition::isAllowed in src/
Entity/ WorkflowTransition.php - Determines if the current transition between 2 states is allowed.
- WorkflowTransition::isValid in src/
Entity/ WorkflowTransition.php - Determines if the Transition is valid and can be executed.
File
- src/
Entity/ WorkflowTransition.php, line 1091
Class
- WorkflowTransition
- Implements an actual, executed, Transition.
Namespace
Drupal\workflow\EntityCode
public function logError($message, $type = 'error', $from_sid = '', $to_sid = '') {
// Prepare an array of arguments for error messages.
$entity = $this
->getTargetEntity();
$t_args = [
/** @var \Drupal\user\UserInterface $user */
'%user' => ($user = $this
->getOwner()) ? $user
->getDisplayName() : '',
'%sid1' => $from_sid || !$this
->getFromState() ? $from_sid : $this
->getFromState()
->label(),
'%sid2' => $to_sid || !$this
->getToState() ? $to_sid : $this
->getToState()
->label(),
'%entity_id' => $this
->getTargetEntityId(),
'%entity_label' => $entity ? $entity
->label() : '',
'@entity_type' => $entity ? $entity
->getEntityTypeId() : '',
'@entity_type_label' => $entity ? $entity
->getEntityType()
->getLabel() : '',
'link' => $this
->getTargetEntityId() && $this
->getTargetEntity()
->hasLinkTemplate('canonical') ? $this
->getTargetEntity()
->toLink($this
->t('View'))
->toString() : '',
];
$type == 'error' ? \Drupal::logger('workflow')
->error($message, $t_args) : \Drupal::logger('workflow')
->notice($message, $t_args);
}