|
14 | 14 | */
|
15 | 15 | use Cake\Core\Plugin;
|
16 | 16 | use Cake\Core\Configure;
|
| 17 | +$namespace = Configure::read('App.namespace'); |
17 | 18 |
|
18 | 19 | $pluginPath = Configure::read('App.paths.plugins.0');
|
19 |
| - |
20 | 20 | $pluginDot = empty($plugin) ? null : $plugin . '.';
|
| 21 | + |
21 | 22 | if (empty($plugin)) {
|
22 | 23 | $filePath = APP_DIR . DS;
|
| 24 | + $namespace = $plugin; |
23 | 25 | }
|
24 | 26 | if (!empty($plugin) && Plugin::loaded($plugin)) {
|
25 | 27 | $filePath = Plugin::classPath($plugin);
|
26 | 28 | }
|
27 | 29 | if (!empty($plugin) && !Plugin::loaded($plugin)) {
|
28 | 30 | $filePath = $pluginPath . h($plugin) . DS . 'src' . DS;
|
29 | 31 | }
|
| 32 | + |
| 33 | +$this->layout = 'dev_error'; |
| 34 | +$this->assign('title', 'Missing View'); |
| 35 | +$this->assign('templateName', 'missing_view.ctp'); |
| 36 | + |
| 37 | +$this->start('subheading'); |
30 | 38 | ?>
|
31 |
| -<h2>Missing View</h2> |
32 |
| -<p class="error"> |
33 | 39 | <strong>Error: </strong>
|
34 |
| - <?= sprintf('<em>%s</em> could not be found.', h($pluginDot . $class)); ?> |
35 |
| - <?php |
36 |
| - if (!empty($plugin) && !Plugin::loaded($plugin)): |
37 |
| - echo sprintf('Make sure your plugin <em>%s</em> is in the %s directory and was loaded.', h($plugin), $pluginPath); |
38 |
| - endif; |
39 |
| - ?> |
40 |
| - <?= $this->element('plugin_class_error'); ?> |
| 40 | + <em><?= h($pluginDot . $class) ?></em> could not be found. |
| 41 | + <?php if (!empty($plugin) && !Plugin::loaded($plugin)): ?> |
| 42 | + Make sure your plugin <em><?= h($plugin) ?></em> is in the <?= h($pluginPath) ?> directory and was loaded. |
| 43 | + <?php endif ?> |
| 44 | + <?= $this->element('plugin_class_error', ['pluginPath' => $pluginPath]) ?> |
41 | 45 | </p>
|
| 46 | +<?php $this->end() ?> |
| 47 | + |
| 48 | +<?php $this->start('file') ?> |
42 | 49 | <p class="error">
|
43 | 50 | <strong>Error: </strong>
|
44 | 51 | <?= sprintf('Create the class <em>%s</em> below in file: %s', h($class), $filePath . 'View' . DS . h($class) . '.php'); ?>
|
45 | 52 | </p>
|
46 |
| -<pre> |
47 |
| -<?php |
48 |
| -class <?= h($class); ?> extends View { |
| 53 | +<?php |
| 54 | +$code = <<<PHP |
| 55 | +<?php |
| 56 | +namespace {$namespace}\View; |
49 | 57 |
|
50 |
| -} |
51 |
| -</pre> |
52 |
| -<p class="notice"> |
53 |
| - <strong>Notice: </strong> |
54 |
| - <?= sprintf('If you want to customize this error message, create %s', APP_DIR . DS . 'Template' . DS . 'Error' . DS . 'missing_view.ctp'); ?> |
55 |
| -</p> |
| 58 | +use Cake\View\View; |
56 | 59 |
|
57 |
| -<?= $this->element('exception_stack_trace'); ?> |
| 60 | +class {$class}View extends View { |
| 61 | +
|
| 62 | +} |
| 63 | +PHP; |
| 64 | +?> |
| 65 | +<div class="code-dump"><?php highlight_string($code) ?></div> |
| 66 | +<?php $this->end() ?> |
0 commit comments