workflow.install
2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @file
* Install, update and uninstall functions for the workflow module.
*/
/**
* Implements hook_install().
*/
function workflow_install() {
$url = \Drupal\Core\Url::fromRoute('system.modules_list', [], ['fragment' => 'edit-modules-workflow']);
$message = t('Thanks for using Workflow. To maintain workflows,
<a href=":url">install the Workflow UI module</a>. To start using
a Workflow, add a Workflow Field to your entity.',
array(':url' => $url->toString())
);
drupal_set_message($message);
}
/**
* Implements hook_uninstall().
*/
function workflow_uninstall() {
// \Drupal::config('workflow.settings')->clear('workflow_states_per_page')->save(); // @FIXME
}
/**
* Implements hook_requirements().
*
* Let admins know that Workflow is in use.
*
* @todo: extend workflow_requirements() for use with Workflow Field API.
*/
function workflow_requirements($phase) {
$requirements = array();
switch ($phase) {
case 'install':
break;
case 'update':
break;
case 'runtime':
// workflow_debug(__FILE__), __FUNCTION__, __LINE__, $form_id); // @todo D8-port: still test this snippet.
/*
// Show info on admin/reports/status.
$type_list = 'Not yet determined.';
// $types = db_query('SELECT wid, type FROM {workflow_type_map} WHERE wid <> 0 ORDER BY type')->fetchAllKeyed();
// If there are no types, then just bail.
if (count($types) == 0) {
return;
}
// Let's make it look nice.
if (count($types) == 1) {
$type_list = current($types);
} else {
$last = array_pop($types);
if (count($types) > 2) {
$type_list = implode(', ', $types) . ', and ' . $last;
} else {
$type_list = current($types) . ' and ' . $last;
}
}
*/
/*
*
$requirements['workflow'] = array(
'title' => $t('Workflow'),
'value' => $t('Workflow is active on the @types content types.', array('@types' => $type_list)),
'severity' => REQUIREMENT_OK,
);
*/
break;
}
return $requirements;
}
/**
* Implements hook_schema().
*
* The D8-schema's have moved to:
* - Workflow annotation (it is a Config Entity now);
* - WorkfowState annotation (it is a Config Entity now);
* - WorkfowConfigTransition annotation (it is a Config Entity now);
* - WorkflowTransition::baseFieldDefinitions();
* - WorkflowScheduledTransition::baseFieldDefinitions().
*/
function workflow_schema() {
return $schema = array();
}
/**
* Drupal 8 updates
*
*/
function workflow_update_8000() {
}