diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 51465c6..6beee43 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -144,7 +144,7 @@ public function getClientConfig(): array 'url' => $this->Link('removeCampaignItem/:id/:itemId'), 'method' => 'post' ], - 'treeClass' => $this->config()->get('model_class') + 'treeClass' => $this->getModelClass() ]); } @@ -234,8 +234,7 @@ protected function getListResource() { $items = $this->getListItems(); $count = $items->count(); - /** @var string $treeClass */ - $treeClass = $this->config()->get('model_class'); + $modelClass = $this->getModelClass(); $hal = [ 'count' => $count, 'total' => $count, @@ -244,12 +243,12 @@ protected function getListResource() 'href' => $this->Link('items') ] ], - '_embedded' => [$treeClass => []] + '_embedded' => [$modelClass => []] ]; foreach ($items as $item) { $sync = $this->shouldCampaignSync($item); $resource = $this->getChangeSetResource($item, $sync); - $hal['_embedded'][$treeClass][] = $resource; + $hal['_embedded'][$modelClass][] = $resource; } return $hal; } @@ -813,11 +812,11 @@ public function providePermissions() return array( "CMS_ACCESS_CampaignAdmin" => array( 'name' => _t( - 'SilverStripe\\CMS\\Controllers\\CMSMain.ACCESS', + LeftAndMain::class . '.ACCESS', "Access to '{title}' section", array('title' => static::menu_title()) ), - 'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access'), + 'category' => _t(LeftAndMain::class . '.CMS_ACCESS_CATEGORY', 'CMS Access'), 'help' => _t( __CLASS__.'.ACCESS_HELP', 'Allow viewing of the campaign publishing section.' diff --git a/src/CampaignAdminList.php b/src/CampaignAdminList.php index aeab18f..9f1b4bf 100644 --- a/src/CampaignAdminList.php +++ b/src/CampaignAdminList.php @@ -32,7 +32,7 @@ public function getSchemaDataDefaults() // Get endpoints from admin $admin = CampaignAdmin::singleton(); - $data['data']['recordType'] = $admin->config()->uninherited('model_class'); + $data['data']['recordType'] = $admin->getModelClass(); $oneSetAction = $admin->Link("set") . "/:id"; $setsAction = $admin->Link("sets"); $schemaEndpoint = $admin->Link("schema") . "/DetailEditForm";