Projet

Général

Profil

Paste
Télécharger (1,67 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / module_filter / module_filter.pages.inc @ 18596a08

1
<?php
2

    
3
/**
4
 * @file
5
 */
6

    
7
/**
8
 * Wrapper function for update_status().
9
 *
10
 * @see update_status().
11
 */
12
function module_filter_update_status() {
13
  module_load_include('inc', 'update', 'update.report');
14
  $update_report = update_status();
15

    
16
  return array(
17
    'module_filter' => drupal_get_form('module_filter_update_status_form'),
18
    'update_report' => array(
19
      '#markup' => $update_report,
20
    ),
21
  );
22
}
23

    
24
/**
25
 * Form builder for the module filter form.
26
 */
27
function module_filter_update_status_form($form, &$form_state) {
28
  $form['module_filter'] = array(
29
    '#type' => 'module_filter',
30
    '#attached' => array(
31
      'css' => array(
32
        drupal_get_path('module', 'module_filter') . '/css/update_status.css',
33
      ),
34
      'js' => array(
35
        drupal_get_path('module', 'module_filter') . '/js/update_status.js',
36
      ),
37
    ),
38
  );
39
  $form['module_filter']['show'] = array(
40
    '#type' => 'radios',
41
    '#default_value' => (isset($_GET['show']) && in_array($_GET['show'], array('all', 'updates', 'security', 'unknown'))) ? $_GET['show'] : 'all',
42
    '#options' => array('all' => t('All'), 'updates' => t('Update available'), 'security' => t('Security update'), 'unknown' => t('Unknown')),
43
    '#prefix' => '<div id="module-filter-show-wrapper">',
44
    '#suffix' => '</div>',
45
  );
46
  if (module_exists('update_advanced')) {
47
    $options = $form['module_filter']['show']['#options'];
48
    $form['module_filter']['show']['#options'] = array_slice($options, 0, 2);
49
    $form['module_filter']['show']['#options']['ignore'] = t('Ignored from settings');
50
    $form['module_filter']['show']['#options'] = array_merge($form['module_filter']['show']['#options'], array_slice($options, 2));
51
  }
52
  return $form;
53
}