public static function JobItem::getStateDefinitions in Translation Management Tool 8
8 calls to JobItem::getStateDefinitions()
- JobItem::getStateIcon in src/Entity/JobItem.php
- Returns a render array to display a job item state icon.
- JobItemState::getValueOptions in src/Plugin/views/filter/JobItemState.php
- Gets the values of the options.
- JobItemState::query in src/Plugin/views/filter/JobItemState.php
- Add this filter to the query.
- JobState::getValueOptions in src/Plugin/views/filter/JobState.php
- Gets the values of the options.
- JobState::query in src/Plugin/views/filter/JobState.php
- Add this filter to the query.
... See full list
File
- src/Entity/JobItem.php, line 1144
Class
- JobItem
- Entity class for the tmgmt_job_item entity.
Namespace
Drupal\tmgmt\Entity
Code
public static function getStateDefinitions() {
if (!empty(static::$stateDefinitions)) {
return static::$stateDefinitions;
}
static::$stateDefinitions = [
static::STATE_ACTIVE => [
'label' => t('In progress'),
'type' => 'state',
'icon' => drupal_get_path('module', 'tmgmt') . '/icons/hourglass.svg',
'weight' => 0,
'show_job_filter' => TRUE,
],
static::STATE_REVIEW => [
'label' => t('Needs review'),
'type' => 'state',
'icon' => drupal_get_path('module', 'tmgmt') . '/icons/ready.svg',
'weight' => 5,
'show_job_filter' => TRUE,
],
static::STATE_ACCEPTED => [
'label' => t('Accepted'),
'type' => 'state',
'weight' => 10,
],
static::STATE_ABORTED => [
'label' => t('Aborted'),
'type' => 'state',
'weight' => 15,
],
static::STATE_INACTIVE => [
'label' => t('Inactive'),
'type' => 'state',
'icon' => drupal_get_path('module', 'tmgmt') . '/icons/rejected.svg',
'weight' => 20,
],
];
\Drupal::moduleHandler()
->alter('tmgmt_job_item_state_definitions', static::$stateDefinitions);
foreach (static::$stateDefinitions as $key => &$definition) {
assert(!empty($definition['type']) && !empty($definition['label']), "State definition {$key} is missing label or type.");
$definition += [
'weight' => 25,
];
}
uasort(static::$stateDefinitions, [
SortArray::class,
'sortByWeightElement',
]);
return static::$stateDefinitions;
}