module_filter.pages.inc 1.6 KB

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