ctools_plugin_test.module 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * @file
  4. * Define some plugin systems to test CTools plugin includes.
  5. */
  6. /**
  7. * Implementation of hook_ctools_plugin_directory().
  8. */
  9. function ctools_plugin_test_ctools_plugin_directory($module, $plugin) {
  10. if ($module == 'ctools_plugin_test') {
  11. return 'plugins/' . $plugin;
  12. }
  13. }
  14. /**
  15. * Implements hook_ctools_plugin_type().
  16. */
  17. function ctools_plugin_test_ctools_plugin_type() {
  18. return array(
  19. 'extra_defaults' => array(
  20. 'defaults' => array(
  21. 'bool' => TRUE,
  22. 'string' => 'string',
  23. 'array' => array('some value'),
  24. ),
  25. ),
  26. 'cached' => array(
  27. 'cache' => TRUE,
  28. 'classes' => array(
  29. 'handler',
  30. ),
  31. ),
  32. 'not_cached' => array(
  33. 'cache' => FALSE,
  34. 'classes' => array(
  35. 'handler',
  36. ),
  37. ),
  38. 'big_hook_cached' => array(
  39. 'cache' => TRUE,
  40. 'use hooks' => TRUE,
  41. 'classes' => array(
  42. 'handler',
  43. ),
  44. ),
  45. 'big_hook_not_cached' => array(
  46. 'cache' => FALSE,
  47. 'use hooks' => TRUE,
  48. 'classes' => array(
  49. 'handler',
  50. ),
  51. ),
  52. );
  53. }
  54. /**
  55. * Plugin callback.
  56. *
  57. * @see ctools_plugin_test_ctools_plugin_type()
  58. */
  59. function ctools_plugin_test_ctools_plugin_test_big_hook_cached() {
  60. return array(
  61. 'test1' => array(
  62. 'function' => 'ctools_plugin_test_hook_cached_test',
  63. 'handler' => 'class1',
  64. ),
  65. );
  66. }
  67. /**
  68. * Plugin callback.
  69. *
  70. * @see ctools_plugin_test_ctools_plugin_type()
  71. */
  72. function ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() {
  73. return array(
  74. 'test1' => array(
  75. 'function' => 'ctools_plugin_test_hook_not_cached_test',
  76. 'class' => 'class1',
  77. ),
  78. );
  79. }
  80. /**
  81. * Callback for the big_hook_cached plugin.
  82. *
  83. * @see ctools_plugin_test_ctools_plugin_test_big_hook_cached
  84. */
  85. function ctools_plugin_test_hook_cached_test() {
  86. }
  87. /**
  88. * Callback for the big_hook_not_cached plugin.
  89. *
  90. * @see ctools_plugin_test_ctools_plugin_test_big_hook_not_cached()
  91. */
  92. function ctools_plugin_test_hook_not_cached_test() {
  93. }