PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Example/Config/bootstrap.php

https://github.com/kareypowell/croogo
PHP | 170 lines | 120 code | 10 blank | 40 comment | 0 complexity | 137bc0a52be38f61c18ae7dd884ba4bd MD5 | raw file
  1. <?php
  2. /**
  3. * Routes
  4. *
  5. * example_routes.php will be loaded in main app/config/routes.php file.
  6. */
  7. Croogo::hookRoutes('Example');
  8. /**
  9. * Behavior
  10. *
  11. * This plugin's Example behavior will be attached whenever Node model is loaded.
  12. */
  13. Croogo::hookBehavior('Node', 'Example.Example', array());
  14. /**
  15. * Component
  16. *
  17. * This plugin's Example component will be loaded in ALL controllers.
  18. */
  19. Croogo::hookComponent('*', 'Example.Example');
  20. /**
  21. * Helper
  22. *
  23. * This plugin's Example helper will be loaded via NodesController.
  24. */
  25. Croogo::hookHelper('Nodes', 'Example.Example');
  26. /**
  27. * Admin menu (navigation)
  28. */
  29. CroogoNav::add('sidebar', 'extensions.children.example', array(
  30. 'title' => 'Example',
  31. 'url' => '#',
  32. 'children' => array(
  33. 'example1' => array(
  34. 'title' => 'Example 1',
  35. 'url' => array(
  36. 'admin' => true,
  37. 'plugin' => 'example',
  38. 'controller' => 'example',
  39. 'action' => 'index',
  40. ),
  41. ),
  42. 'example2' => array(
  43. 'title' => 'Example 2 with a title that won\'t fit in the sidebar',
  44. 'url' => '#',
  45. 'children' => array(
  46. 'example-2-1' => array(
  47. 'title' => 'Example 2-1',
  48. 'url' => '#',
  49. 'children' => array(
  50. 'example-2-1-1' => array(
  51. 'title' => 'Example 2-1-1',
  52. 'url' => '#',
  53. 'children' => array(
  54. 'example-2-1-1-1' => array(
  55. 'title' => 'Example 2-1-1-1',
  56. ),
  57. ),
  58. ),
  59. ),
  60. ),
  61. ),
  62. ),
  63. 'example3' => array(
  64. 'title' => 'Chooser Example',
  65. 'url' => array(
  66. 'admin' => true,
  67. 'plugin' => 'example',
  68. 'controller' => 'example',
  69. 'action' => 'chooser',
  70. ),
  71. ),
  72. 'example4' => array(
  73. 'title' => 'RTE Example',
  74. 'url' => array(
  75. 'admin' => true,
  76. 'plugin' => 'example',
  77. 'controller' => 'example',
  78. 'action' => 'rte_example',
  79. ),
  80. ),
  81. ),
  82. ));
  83. $Localization = new L10n();
  84. Croogo::mergeConfig('Wysiwyg.actions', array(
  85. 'Example/admin_rte_example' => array(
  86. array(
  87. 'elements' => 'ExampleBasic',
  88. 'preset' => 'basic',
  89. ),
  90. array(
  91. 'elements' => 'ExampleStandard',
  92. 'preset' => 'standard',
  93. 'language' => 'ja',
  94. ),
  95. array(
  96. 'elements' => 'ExampleFull',
  97. 'preset' => 'full',
  98. 'language' => $Localization->map(Configure::read('Site.locale')),
  99. ),
  100. array(
  101. 'elements' => 'ExampleCustom',
  102. 'toolbar' => array(
  103. array('Format', 'Bold', 'Italic'),
  104. array('Copy', 'Paste'),
  105. ),
  106. 'uiColor' => '#ffe79a',
  107. 'language' => 'fr',
  108. ),
  109. ),
  110. ));
  111. /**
  112. * Admin row action
  113. *
  114. * When browsing the content list in admin panel (Content > List),
  115. * an extra link called 'Example' will be placed under 'Actions' column.
  116. */
  117. Croogo::hookAdminRowAction('Nodes/admin_index', 'Example', 'plugin:example/controller:example/action:index/:id');
  118. /* Row action with link options */
  119. Croogo::hookAdminRowAction('Nodes/admin_index', 'Button with Icon', array(
  120. 'plugin:example/controller:example/action:index/:id' => array(
  121. 'options' => array(
  122. 'icon' => 'key',
  123. 'button' => 'success',
  124. ),
  125. ),
  126. ));
  127. /* Row action with icon */
  128. Croogo::hookAdminRowAction('Nodes/admin_index', 'Icon Only', array(
  129. 'plugin:example/controller:example/action:index/:id' => array(
  130. 'title' => false,
  131. 'options' => array(
  132. 'icon' => 'picture',
  133. 'tooltip' => array(
  134. 'data-title' => 'A nice and simple action with tooltip',
  135. 'data-placement' => 'left',
  136. ),
  137. ),
  138. ),
  139. ));
  140. /* Row action with confirm message */
  141. Croogo::hookAdminRowAction('Nodes/admin_index', 'Reload Page', array(
  142. 'admin:true/plugin:nodes/controller:nodes/action:index' => array(
  143. 'title' => false,
  144. 'options' => array(
  145. 'icon' => 'refresh',
  146. 'tooltip' => 'Reload page',
  147. ),
  148. 'confirmMessage' => 'Reload this page?',
  149. ),
  150. ));
  151. /**
  152. * Admin tab
  153. *
  154. * When adding/editing Content (Nodes),
  155. * an extra tab with title 'Example' will be shown with markup generated from the plugin's admin_tab_node element.
  156. *
  157. * Useful for adding form extra form fields if necessary.
  158. */
  159. Croogo::hookAdminTab('Nodes/admin_add', 'Example', 'example.admin_tab_node');
  160. Croogo::hookAdminTab('Nodes/admin_edit', 'Example', 'example.admin_tab_node');