You are here

public function StateInformation::getStatusDefinition in Entity Share 8.3

Parameters

string $status_info_id: An identifier of the status info (the value of 'INFO_ID_...' constant).

Return value

array Keyed by status ID, values containing:

  • label,
  • CSS class suffix.

Overrides StateInformationInterface::getStatusDefinition

1 call to StateInformation::getStatusDefinition()
StateInformation::statusInfoArray in modules/entity_share_client/src/Service/StateInformation.php
Helper function: generates status information for a known status ID.

File

modules/entity_share_client/src/Service/StateInformation.php, line 150

Class

StateInformation
Service to handle presentation of import state.

Namespace

Drupal\entity_share_client\Service

Code

public function getStatusDefinition(string $status_info_id) {
  $definitions = [
    StateInformationInterface::INFO_ID_UNDEFINED => [
      'label' => $this
        ->t('Undefined'),
      'class' => 'undefined',
    ],
    StateInformationInterface::INFO_ID_UNKNOWN => [
      'label' => $this
        ->t('Unknown entity type'),
      'class' => 'undefined',
    ],
    StateInformationInterface::INFO_ID_NEW => [
      'label' => $this
        ->t('New entity'),
      'class' => 'new',
    ],
    StateInformationInterface::INFO_ID_NEW_TRANSLATION => [
      'label' => $this
        ->t('New translation'),
      'class' => 'new',
    ],
    StateInformationInterface::INFO_ID_CHANGED => [
      'label' => $this
        ->t('Entities not synchronized'),
      'class' => 'changed',
    ],
    StateInformationInterface::INFO_ID_SYNCHRONIZED => [
      'label' => $this
        ->t('Entities synchronized'),
      'class' => 'up-to-date',
    ],
  ];
  return $definitions[$status_info_id] ?? $definitions[StateInformationInterface::INFO_ID_UNDEFINED];
}