function tmgmt_color_legend in Translation Management Tool 8
Provides color legends for source statuses.
Return value
array Color legend render array.
1 call to tmgmt_color_legend()
- SourceOverviewForm::buildForm in src/
Form/ SourceOverviewForm.php - Form constructor.
File
- ./
tmgmt.module, line 939 - Main module file for the Translation Management module.
Code
function tmgmt_color_legend() {
$items = [
[
'icon' => file_create_url('core/misc/icons/bebebe/house.svg'),
'legend' => t('Original language'),
],
[
'icon' => file_create_url('core/misc/icons/bebebe/ex.svg'),
'legend' => t('Not translated'),
],
[
'icon' => file_create_url('core/misc/icons/73b355/check.svg'),
'legend' => t('Translated'),
],
[
'icon' => file_create_url(drupal_get_path('module', 'tmgmt') . '/icons/outdated.svg'),
'legend' => t('Translation Outdated'),
],
];
$output[] = [
'#attached' => array(
'library' => [
'tmgmt/admin.seven',
'tmgmt/admin',
],
),
'#theme' => 'tmgmt_legend',
'#title' => t('Source status:'),
'#items' => $items,
];
$items = [];
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'],
];
}
}
$output[] = [
'#attached' => array(
'library' => [
'tmgmt/admin.seven',
'tmgmt/admin',
],
),
'#theme' => 'tmgmt_legend',
'#title' => t('Item status:'),
'#items' => $items,
'#prefix' => '<div class="clear"></div>',
];
$output['#prefix'] = '<div class="tmgmt-color-legend clearfix">';
$output['#suffix'] = '</div>';
return $output;
}