1 |
be880f98
|
Florent Torregrosa
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Wrapper function for update_status().
|
5 |
|
|
*
|
6 |
|
|
* @see update_status().
|
7 |
|
|
*/
|
8 |
|
|
function module_filter_update_status() {
|
9 |
|
|
module_load_include('inc', 'update', 'update.report');
|
10 |
|
|
$update_report = update_status();
|
11 |
|
|
|
12 |
|
|
return array(
|
13 |
|
|
'module_filter' => drupal_get_form('module_filter_update_status_form'),
|
14 |
|
|
'update_report' => array(
|
15 |
|
|
'#markup' => $update_report
|
16 |
|
|
)
|
17 |
|
|
);
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
function module_filter_update_status_form($form, &$form_state) {
|
21 |
|
|
$form['module_filter'] = array(
|
22 |
|
|
'#type' => 'module_filter',
|
23 |
|
|
'#attached' => array(
|
24 |
|
|
'css' => array(
|
25 |
|
|
drupal_get_path('module', 'module_filter') . '/css/update_status.css'
|
26 |
|
|
),
|
27 |
|
|
'js' => array(
|
28 |
|
|
drupal_get_path('module', 'module_filter') . '/js/update_status.js'
|
29 |
|
|
),
|
30 |
|
|
),
|
31 |
|
|
);
|
32 |
|
|
$form['module_filter']['show'] = array(
|
33 |
|
|
'#type' => 'radios',
|
34 |
|
|
'#default_value' => (isset($_GET['show']) && in_array($_GET['show'], array('all', 'updates', 'security', 'unknown'))) ? $_GET['show'] : 'all',
|
35 |
|
|
'#options' => array('all' => t('All'), 'updates' => t('Update available'), 'security' => t('Security update'), 'unknown' => t('Unknown')),
|
36 |
|
|
'#prefix' => '<div id="module-filter-show-wrapper">',
|
37 |
|
|
'#suffix' => '</div>'
|
38 |
|
|
);
|
39 |
|
|
if (module_exists('update_advanced')) {
|
40 |
|
|
$options = $form['module_filter']['show']['#options'];
|
41 |
|
|
$form['module_filter']['show']['#options'] = array_slice($options, 0, 2);
|
42 |
|
|
$form['module_filter']['show']['#options']['ignore'] = t('Ignored from settings');
|
43 |
|
|
$form['module_filter']['show']['#options'] = array_merge($form['module_filter']['show']['#options'], array_slice($options, 2));
|
44 |
|
|
}
|
45 |
|
|
return $form;
|
46 |
|
|
} |