protected function StateInformation::statusInfoArray in Entity Share 8.3
Helper function: generates status information for a known status ID.
Parameters
string $status_info_id: An identifier of the status info (the value of 'INFO_ID_...' constant).
\Drupal\Core\Entity\ContentEntityInterface $entity: A Drupal content entity.
Return value
array The same as return value of getStatusInfo().
1 call to StateInformation::statusInfoArray()
- StateInformation::getStatusInfo in modules/
entity_share_client/ src/ Service/ StateInformation.php - Check if an entity already exists or not and get status info.
File
- modules/
entity_share_client/ src/ Service/ StateInformation.php, line 191
Class
- StateInformation
- Service to handle presentation of import state.
Namespace
Drupal\entity_share_client\ServiceCode
protected function statusInfoArray(string $status_info_id, ContentEntityInterface $entity = NULL) {
$status_definition = $this
->getStatusDefinition($status_info_id);
$status_info = [
'label' => $status_definition['label'],
'class' => 'entity-share-' . $status_definition['class'],
'info_id' => $status_info_id,
'local_entity_link' => NULL,
'local_revision_id' => NULL,
];
if ($entity instanceof ContentEntityInterface) {
try {
$status_info['local_entity_link'] = $entity
->toUrl();
} catch (UndefinedLinkTemplateException $exception) {
// Do nothing, the link remains NULL.
}
// If entity type is not revisionable, this will remain NULL.
$status_info['local_revision_id'] = $entity
->getRevisionId();
}
return $status_info;
}