|
10 | 10 |
|
11 | 11 | namespace EightshiftLibs\AdminMenus; |
12 | 12 |
|
13 | | -use EightshiftLibs\Helpers\Helpers; |
14 | 13 | use EightshiftLibs\Services\ServiceInterface; |
15 | | -use EightshiftLibs\Blocks\RenderableBlockInterface; |
16 | 14 | use Exception; |
17 | 15 |
|
18 | 16 | /** |
19 | 17 | * Abstract class AbstractAdminMenu class. |
20 | 18 | * |
21 | 19 | * Class responsible for creating admin menus, separately from CPT admin menus. |
22 | 20 | */ |
23 | | -abstract class AbstractAdminMenu implements ServiceInterface, RenderableBlockInterface |
| 21 | +abstract class AbstractAdminMenu implements ServiceInterface |
24 | 22 | { |
25 | 23 | /** |
26 | 24 | * Register all the hooks |
@@ -78,29 +76,7 @@ public function processAdminMenu($attr): void |
78 | 76 | $attr['adminMenuSlug'] = $this->getMenuSlug(); |
79 | 77 | $attr['nonceField'] = $this->renderNonce(); |
80 | 78 |
|
81 | | - echo $this->render((array)$attr); // phpcs:ignore |
82 | | - } |
83 | | - |
84 | | - /** |
85 | | - * Render the current view. |
86 | | - * |
87 | | - * @param array<string, mixed> $attributes Array of attributes passed to the view. |
88 | | - * @param string $innerBlockContent Not used here. |
89 | | - * |
90 | | - * @return string Rendered HTML. |
91 | | - * @throws Exception On missing attributes OR missing template. |
92 | | - */ |
93 | | - public function render(array $attributes = [], string $innerBlockContent = ''): string |
94 | | - { |
95 | | - try { |
96 | | - return Helpers::render($this->getViewComponent(), $attributes); |
97 | | - } catch (Exception $exception) { // To do: once new libs are released, replace with ComponentException. |
98 | | - // Don't let exceptions bubble up. Just render the exception message into the admin menu. |
99 | | - return \sprintf( |
100 | | - '<pre>%s</pre>', |
101 | | - $exception->getMessage() |
102 | | - ); |
103 | | - } |
| 79 | + echo $this->getViewComponent($attr); // phpcs:ignore |
104 | 80 | } |
105 | 81 |
|
106 | 82 | /** |
|
0 commit comments