-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbackdrop_upgrade_status.api.inc
102 lines (93 loc) · 3.06 KB
/
backdrop_upgrade_status.api.inc
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
<?php
/**
* @file
* API: Hooks provided by this module.
*/
/**
* Returns all content needed for the Backdrop Upgrade Status report.
*
* @param array $renderable
*
* @return array
* An array containing all the data needed to build a table on the report,
* containing the following keys:
* - machine: The machine name of the checkbox.
* - title: The content for fieldset label, as passed through t().
* - info: The content for the introductary paragraph, passed through t().
* - header: Array of columnn headers for data, each passed through t().
* - rows: Table of data (must match column headers), sanitized.
* - empty: Text to display when there are no rows.
* - collapsed: Whether or not the fieldset should be collapsed.
* - todo_status: deprecated. do not use.
*/
function hook_backdrop_upgrade_status_report() {
// Get current state.
$profile_collapsed = backdrop_upgrade_status_get_state('profile');
$return = array(
'machine' => 'profile',
'title' => t('Profile / Distribution'),
'info' => t('This is the profile that was used when the site was first installed.'),
'header' => array(t('Profile name'), t('Enabled'), t('Distribution'), t('Backdrop status'), t('Recommendation')),
'rows' => $profile_rows,
'empty' => '',
'collapsed' => $profile_collapsed,
);
return $return;
}
/**
* Implements hook_backdrop_upgrade_status_report_alter().
*
* @param array &$renderable
* The renderable array used as the form on the overview page.
*/
function hook_backdrop_upgrade_status_report_alter(&$renderable) {
// @todo
}
/**
* Implements hook_backdrop_upgrade_status_scan().
*
* @return array
* For each key in hook_backdrop_upgrade_status_todo, return TRUE or FALSE.
*
* @see hook_backdrop_upgrade_status_todo().
*/
function hook_backdrop_upgrade_status_scan() {
$styles = image_styles();
foreach ($styles as $style) {
$editable = (bool) ($style['storage'] && IMAGE_STORAGE_EDITABLE);
if (!$editable) {
return array('image' => FALSE);
}
}
return array('image' => TRUE);
}
/**
* Implements hook_backdrop_upgrade_status_todo().
*
* @return array
* Todo item info, keyed by machine name. Info contains the following keys.
* - review: Human-readable name of the item to review.
* - description: Description of the item to review.
* - optional: Boolean, TRUE if the item shoudl be labeled as optional.
*/
function hook_backdrop_upgrade_status_todo() {
return array(
'profile' => array(
'review' => 'system profile',
'description' => 'Check that a Backdrop version is available.',
'optional' => TRUE,
),
);
}
/**
* Implements hook_backdrop_upgrade_status_todo_alter().
*
* @param array $todo_items
* Todo item info, keyed by machine name. Info contains the following keys.
* - review: Human-readable name of the item to review.
* - description: Description of the item to review.
* - optional: Boolean, TRUE if the item shoudl be labeled as optional.
*/
function backdrop_upgrade_status_todo_alter(&$todo_items) {
unset($todo_items['profile']);
}