function tmgmt_color_job_legend in Translation Management Tool 8
Provides color legends for job states.
Return value
array Color legend render array.
1 call to tmgmt_color_job_legend()
- JobLegend::render in src/
Plugin/ views/ area/ JobLegend.php - Render the area.
File
- ./
tmgmt.module, line 1025 - Main module file for the Translation Management module.
Code
function tmgmt_color_job_legend() {
$items = [
[
'icon' => file_create_url(drupal_get_path('module', 'tmgmt') . '/icons/rejected.svg'),
'legend' => t('Unprocessed'),
],
];
foreach (JobItem::getStateDefinitions() as $state_definition) {
if (!empty($state_definition['icon'])) {
$items[] = [
'icon' => file_url_transform_relative(file_create_url($state_definition['icon'])),
'legend' => $state_definition['label'],
];
}
}
if (\Drupal::service('tmgmt.continuous')
->hasContinuousJobs()) {
$items[] = [
'icon' => file_create_url(drupal_get_path('module', 'tmgmt') . '/icons/continuous.svg'),
'legend' => t('Continuous'),
];
}
$output = [
'#attached' => array(
'library' => [
'tmgmt/admin.seven',
'tmgmt/admin',
],
),
'#theme' => 'tmgmt_legend',
'#title' => t('State:'),
'#items' => $items,
'#prefix' => '<div class="tmgmt-color-legend clearfix">',
'#suffix' => '</div>',
];
return $output;
}