stylizer.module

Tracking 6.x-1.x branch
  1. drupal
    1. 6 contributions/ctools/stylizer/stylizer.module
    2. 7 contributions/ctools/stylizer/stylizer.module

Stylizer module

This module allows styles to be created and managed on behalf of modules that implement styles.

The Stylizer tool allows recolorable styles to be created via a miniature scripting language. Panels utilizes this to allow administrators to add styles directly to any panel display.

Functions & methods

NameDescription
stylizer_ctools_plugin_directoryImplementation of hook_ctools_plugin_directory() to let the system know we implement task and task_handler plugins.
stylizer_panels_dashboard_blocksImplementation of hook_panels_dashboard_blocks().
stylizer_permImplementation of hook_perm()

File

View source
  1. <?php
  2. /**
  3. * @file
  4. * Stylizer module
  5. *
  6. * This module allows styles to be created and managed on behalf of modules
  7. * that implement styles.
  8. *
  9. * The Stylizer tool allows recolorable styles to be created via a miniature
  10. * scripting language. Panels utilizes this to allow administrators to add
  11. * styles directly to any panel display.
  12. */
  13. /**
  14. * Implementation of hook_perm()
  15. */
  16. function stylizer_perm() {
  17. return array(
  18. 'administer stylizer',
  19. );
  20. }
  21. /**
  22. * Implementation of hook_ctools_plugin_directory() to let the system know
  23. * we implement task and task_handler plugins.
  24. */
  25. function stylizer_ctools_plugin_directory($module, $plugin) {
  26. // Most of this module is implemented as an export ui plugin, and the
  27. // rest is in ctools/includes/stylizer.inc
  28. if ($module == 'ctools' && $plugin == 'export_ui') {
  29. return 'plugins/' . $plugin;
  30. }
  31. }
  32. /**
  33. * Implementation of hook_panels_dashboard_blocks().
  34. *
  35. * Adds page information to the Panels dashboard.
  36. */
  37. function stylizer_panels_dashboard_blocks(&$vars) {
  38. $vars['links']['stylizer'] = array(
  39. 'title' => l(t('Custom style'), 'admin/build/stylizer/add'),
  40. 'description' => t('Custom styles can be applied to Panel regions and Panel panes.'),
  41. );
  42. // Load all mini panels and their displays.
  43. ctools_include('export');
  44. ctools_include('stylizer');
  45. $items = ctools_export_crud_load_all('stylizer');
  46. $count = 0;
  47. $rows = array();
  48. $base_types = ctools_get_style_base_types();
  49. foreach ($items as $item) {
  50. $style = ctools_get_style_base($item->settings['style_base']);
  51. if ($style && $style['module'] == 'panels') {
  52. $type = $base_types[$style['module']][$style['type']]['title'];
  53. $rows[] = array(
  54. check_plain($item->admin_title),
  55. $type,
  56. array(
  57. 'data' => l(t('Edit'), "admin/build/stylizer/list/$item->name/edit"),
  58. 'class' => 'links',
  59. ),
  60. );
  61. // Only show 10.
  62. if (++$count >= 10) {
  63. break;
  64. }
  65. }
  66. }
  67. if ($rows) {
  68. $content = theme('table', array(), $rows, array('class' => 'panels-manage'));
  69. }
  70. else {
  71. $content = '<p>' . t('There are no custom styles.') . '</p>';
  72. }
  73. $vars['blocks']['stylizer'] = array(
  74. 'title' => t('Manage styles'),
  75. 'link' => l(t('Go to list'), 'admin/build/stylizer'),
  76. 'content' => $content,
  77. 'class' => 'dashboard-styles',
  78. 'section' => 'left',
  79. );
  80. }