public function JobItem::getStateIcon in Translation Management Tool 8
Returns a render array to display a job item state icon.
Return value
array|null A render array for the icon or NULL if there is none for the current state.
Overrides JobItemInterface::getStateIcon
File
- src/
Entity/ JobItem.php, line 1103
Class
- JobItem
- Entity class for the tmgmt_job_item entity.
Namespace
Drupal\tmgmt\EntityCode
public function getStateIcon() {
$state_definitions = static::getStateDefinitions();
$state_definition = NULL;
$translator_state = $this
->getTranslatorState();
if ($translator_state && isset($state_definitions[$translator_state]['icon'])) {
$state_definition = $state_definitions[$translator_state];
}
elseif (isset($state_definitions[$this
->getState()]['icon'])) {
$state_definition = $state_definitions[$this
->getState()];
}
if ($state_definition) {
return [
'#theme' => 'image',
'#uri' => $state_definition['icon'],
'#title' => $state_definition['label'],
'#alt' => $state_definition['label'],
'#width' => 16,
'#height' => 16,
'#weight' => $state_definition['weight'],
];
}
}