File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1515 ],
1616 // Default View class to use
1717 'viewClass ' => null ,
18+ // Plugins to include for View annotations
19+ 'includedPlugins ' => [
20+ ],
1821 // Always add annotations/meta even if not yet needed
1922 'preemptive ' => false ,
2023 // For meta file generator
Original file line number Diff line number Diff line change @@ -168,6 +168,10 @@ class AppView extends View {
168168}
169169```
170170
171+ ### Include plugins
172+ Using Configure key ` 'IdeHelper.includedPlugins' ` you can set an array of (loaded!) plugins to include.
173+ Those will then also be parsed and all found helpers added to the AppView annotations.
174+
171175## Components
172176Components should annotate any component they use.
173177
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ protected function _getHelpers() {
4242
4343 $ plugin = null ;
4444 $ folders = App::path ('Template ' , $ plugin );
45+ $ plugins = (array )Configure::read ('IdeHelper.includedPlugins ' );
46+ foreach ($ plugins as $ plugin ) {
47+ $ folders = array_merge ($ folders , App::path ('Template ' , $ plugin ));
48+ }
4549
4650 $ this ->helpers = [];
4751 foreach ($ folders as $ folder ) {
@@ -106,9 +110,12 @@ protected function _parseHelpersInContent($content) {
106110 protected function _parseViewClass () {
107111 $ helpers = [];
108112
109- $ className = App::className ('App ' , 'View ' , 'View ' );
113+ $ className = App::className ('App ' , 'Controller ' , 'Controller ' );
114+ /** @var \App\Controller\AppController $Controller */
115+ $ Controller = new $ className ();
110116 /** @var \App\View\AppView $View */
111- $ View = new $ className ();
117+ $ View = $ Controller ->createView ();
118+
112119 foreach ($ View ->helpers () as $ alias => $ helper ) {
113120 $ className = get_class ($ helper );
114121 if (strpos ($ className , 'Cake \\' ) === 0 ) {
You can’t perform that action at this time.
0 commit comments