From f4c356011d621da5616ea4ef1e779ee1ffd7ff45 Mon Sep 17 00:00:00 2001
From: Roman Parpalak
- = $trans('Preview ready') ?>
diff --git a/_extensions/s2_blog/Admin/AdminConfigExtender.php b/_extensions/s2_blog/Admin/AdminConfigExtender.php index b8fdc2d..46687bd 100644 --- a/_extensions/s2_blog/Admin/AdminConfigExtender.php +++ b/_extensions/s2_blog/Admin/AdminConfigExtender.php @@ -23,7 +23,6 @@ use S2\AdminYard\Database\LogicalExpression; use S2\AdminYard\Event\AfterLoadEvent; use S2\AdminYard\Event\AfterSaveEvent; -use S2\AdminYard\Event\BeforeDeleteEvent; use S2\AdminYard\Event\BeforeRenderEvent; use S2\AdminYard\Event\BeforeSaveEvent; use S2\AdminYard\Translator; @@ -35,6 +34,7 @@ use S2\Cms\Admin\Event\VisibleEntityChangedEvent; use S2\Cms\Model\PermissionChecker; use S2\Cms\Model\TagsProvider; +use S2\Cms\Pdo\DbLayerException; use S2\Cms\Template\HtmlTemplateProvider; use s2_extensions\s2_blog\BlogUrlBuilder; use s2_extensions\s2_blog\Model\BlogCommentNotifier; @@ -328,7 +328,7 @@ public function extend(AdminConfig $adminConfig): void label: $this->translator->trans('Author'), type: new DbColumnFieldType(FieldConfig::DATA_TYPE_INT, defaultValue: $this->permissionChecker->getUserId()), control: 'select', - linkToEntity: new LinkTo($adminConfig->findEntityByName('User'), 'CASE WHEN name IS NULL OR name = \'\' THEN login ELSE name END', new LogicalExpression('create_articles', 1)), + linkToEntity: new LinkTo($adminConfig->findEntityByName('User'), 'CASE WHEN name IS NULL OR name = \'\' THEN login ELSE name END'), useOnActions: [ FieldConfig::ACTION_LIST, ...$this->permissionChecker->isGranted(PermissionChecker::PERMISSION_EDIT_SITE) ? [FieldConfig::ACTION_EDIT] : [], @@ -562,11 +562,15 @@ public function extend(AdminConfig $adminConfig): void ; } + /** + * @throws DbLayerException + */ private function getPostStatusData(int $createTime, string $url): array { $urlStatus = $this->postProvider->checkUrlStatus($createTime, $url); return [ + 'url' => $this->blogUrlBuilder->postFromTimestamp($createTime, $url), 'urlStatus' => $urlStatus, 'urlTitle' => match ($urlStatus) { 'empty' => $this->translator->trans('URL empty'), diff --git a/_extensions/s2_blog/views/admin/post/edit.php.inc b/_extensions/s2_blog/views/admin/post/edit.php.inc index e477e2f..7134414 100644 --- a/_extensions/s2_blog/views/admin/post/edit.php.inc +++ b/_extensions/s2_blog/views/admin/post/edit.php.inc @@ -156,7 +156,7 @@ $jsvarencode = static function ($var) {- = $trans('Preview ready') ?> + = $trans('Preview ready') ?>
diff --git a/_include/src/Admin/AdminConfigProvider.php b/_include/src/Admin/AdminConfigProvider.php index 8b42259..116615d 100644 --- a/_include/src/Admin/AdminConfigProvider.php +++ b/_include/src/Admin/AdminConfigProvider.php @@ -549,7 +549,7 @@ function (BeforeSaveEvent $event) { label: $this->translator->trans('Author'), type: new DbColumnFieldType(FieldConfig::DATA_TYPE_INT), control: 'select', - linkToEntity: new LinkTo($userEntity, 'CASE WHEN name IS NULL OR name = \'\' THEN login ELSE name END', new LogicalExpression('create_articles', 1)), + linkToEntity: new LinkTo($userEntity, 'CASE WHEN name IS NULL OR name = \'\' THEN login ELSE name END'), useOnActions: [ FieldConfig::ACTION_LIST, ...$this->permissionChecker->isGranted(PermissionChecker::PERMISSION_EDIT_SITE) ? [FieldConfig::ACTION_EDIT] : [], @@ -970,6 +970,7 @@ private function getArticleStatusData(int $articleId): array [$urlStatus, $templateStatus] = $this->articleProvider->checkUrlAndTemplateStatus($articleId); return [ + 'url' => $this->articleProvider->pathFromId($articleId), 'urlStatus' => $urlStatus, 'urlTitle' => match ($urlStatus) { 'empty' => $this->translator->trans('URL empty'),