Provides color legends for local tasks.
array Color legend render array.
function tmgmt_color_legend_local_task() {
$npath = \Drupal::service('extension.list.module')
->getPath('tmgmt');
$items = [
[
'icon' => \Drupal::service('file_url_generator')
->generateAbsoluteString($npath . '/icons/rejected.svg'),
'legend' => t('Unassigned'),
],
[
'icon' => \Drupal::service('file_url_generator')
->generateAbsoluteString($npath . '/icons/ready.svg'),
'legend' => t('Needs action'),
],
[
'icon' => \Drupal::service('file_url_generator')
->generateAbsoluteString($npath . '/icons/hourglass.svg'),
'legend' => t('In review'),
],
[
'icon' => \Drupal::service('file_url_generator')
->generateAbsoluteString($npath . '/icons/ex-red.svg'),
'legend' => t('Rejected'),
],
[
'icon' => \Drupal::service('file_url_generator')
->generateAbsoluteString('core/misc/icons/73b355/check.svg'),
'legend' => t('Closed'),
],
];
$output = [
'#attached' => array(
'library' => [
'tmgmt/admin.seven',
'tmgmt/admin',
],
),
'#theme' => 'tmgmt_local_legend',
'#title' => t('Status:'),
'#items' => $items,
'#prefix' => '<div class="tmgmt-color-legend clearfix">',
'#suffix' => '</div>',
];
return $output;
}