text_formats_report_stats.theme.inc 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * @file
  4. */
  5. /**
  6. * Preprocess function for theme_text_formats_report_stats();.
  7. */
  8. /**
  9. *
  10. */
  11. function template_preprocess_text_formats_report_stats(&$variables) {
  12. // Prepare just the filter titles per filter format.
  13. $filter_lists = $variables['filter_formats_filter_lists'];
  14. $filter_lists_titles = array();
  15. foreach ($filter_lists as $filter_format => $row) {
  16. foreach ($row as $filter) {
  17. if ($filter->status == 1) {
  18. $filter_lists_titles[] = check_plain($filter->title);
  19. }
  20. }
  21. $variables['filter_formats_filter_lists'][$filter_format] = $filter_lists_titles;
  22. }
  23. }
  24. /**
  25. * Theme implementation.
  26. *
  27. * @see template_preprocess_text_formats_report_stats()
  28. */
  29. function theme_text_formats_report_stats(&$variables) {
  30. $content = '';
  31. $content .= '<h2>' . t("Custom blocks using the formats") . '</h2>';
  32. $content .= (empty($variables['custom_blocks'])) ? '<p>' . t("None") . '</p>' : theme('table', text_formats_report_prepare_table($variables['custom_blocks']));
  33. $entities = (isset($variables['entities'])) ? $variables['entities'] : array();
  34. if (empty($entities)) {
  35. return $content;
  36. }
  37. $tabs_list = '';
  38. $tabs_content = '';
  39. // Used for ui.tabs navigation.
  40. $id = 0;
  41. foreach ($entities as $filter_format => $row) {
  42. $id++;
  43. $tabs_list .= '<li><a href="#tabs-' . $id . '">' . $filter_format . '</a></li>';
  44. $tabs_content .= '<div id="tabs-' . $id . '">';
  45. $tabs_content .= '<p><strong>' . t("Total entities using <em>@format</em>: ", array('@format' => $filter_format)) . '</strong><em>' . $entities[$filter_format]['total_content'] . '</em></p>';
  46. $tabs_content .= theme('item_list', array(
  47. 'items' => $variables['filter_formats_filter_lists'][$filter_format],
  48. 'title' => t('Filters enabled for <em>@format</em> (@count)', array('@format' => $filter_format, '@count' => count($variables['filter_formats_filter_lists'][$filter_format]))),
  49. )
  50. );
  51. $tabs_content .= '<p>' . l(t("Configure @format", array('@format' => $filter_format)), "admin/config/content/formats/$filter_format") . '</p>';
  52. $tabs_content .= '<h3>' . t("Bundles using <em>@format</em> (@count)", array('@format' => $filter_format, '@count' => count($entities[$filter_format]['bundles']))) . '</h3>';
  53. $tabs_content .= theme('table', text_formats_report_prepare_simple_table($entities[$filter_format]['bundles'], array('Bundle name', 'Entities')));
  54. $tabs_content .= '<h3>' . t("Fields using <em>@format</em> (@count)", array('@format' => $filter_format, '@count' => count($entities[$filter_format]['fields']))) . '</h3>';
  55. $tabs_content .= '<p><em>' . t("Click on the field names to see the content in them.") . '</em></p>';
  56. $tabs_content .= theme('table', text_formats_report_prepare_simple_table($entities[$filter_format]['fields'], array('Field name', 'Entities')));
  57. $tabs_content .= '</div>';
  58. }
  59. $content .= '<div id="filter-format-tabs">';
  60. $content .= '<div id="tab-list" class="item-list"><ul>' . $tabs_list . '</ul></div>';
  61. $content .= '<div id="tab-content">' . $tabs_content . '</div>';
  62. $content .= '</div>';
  63. return $content;
  64. }