/** * Hook admin tabs for controllers whom its primary model has MetaBehavior attached. */ protected function _adminTabs() { $controller = $this->_registry->getController(); $table = TableRegistry::get($controller->modelClass); if ($table && !($table->behaviors()->has('Meta') && $table->behaviors()->has('FeaturedImage'))) { return; } $title = __d('croogo', 'Featured image'); $element = 'FeaturedImage.admin/featured_image'; $controllerName = $this->request->param('controller'); Croogo::hookAdminBox("Admin/{$controllerName}/add", $title, $element); Croogo::hookAdminBox("Admin/{$controllerName}/edit", $title, $element); }
<?php \Croogo\Core\Croogo::hookComponent('Croogo/Nodes.Nodes', ['FeaturedImage.FeaturedImage' => ['priority' => 5]]); \Croogo\Core\Croogo::hookComponent('Croogo/Nodes.Admin/Nodes', ['FeaturedImage.FeaturedImage' => ['priority' => 5]]); \Croogo\Core\Croogo::hookBehavior('Croogo/Nodes.Nodes', 'FeaturedImage.FeaturedImage'); \Croogo\Core\Croogo::hookHelper('Croogo/Nodes.Admin/Nodes', 'Croogo/Core.Image');