Skip to content

Commit

Permalink
固定ページの新規作成時、作成者の初期値を設定
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Dec 14, 2024
1 parent 378a8e8 commit d0dba2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/baser-core/src/Service/PagesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public function getNew(int $parentId = null, string $name = ''): EntityInterface
$name = BcUtil::urlencode(mb_substr($name, 0, 230, 'UTF-8'));
} else {
$title = '';
}
$authorId = null;
if(BcUtil::isAdminUser()) {
$authorId = BcUtil::loginUser()->id;
}
return $this->Pages->newEntity([
'content' => [
Expand All @@ -110,7 +114,8 @@ public function getNew(int $parentId = null, string $name = ''): EntityInterface
'site_root' => false,
'site_id' => $parent->site_id,
'parent_id' => $parent->id,
'self_status' => false
'self_status' => false,
'author_id' => $authorId
]
], ['associated' => ['Contents' => ['validate' => false]]]);
}
Expand Down

0 comments on commit d0dba2d

Please sign in to comment.