Skip to content

【システム】 コンテンツコピー時に layout_template が引き継がれない #4337

@teratai3

Description

@teratai3

概要

固定ページをコピーする際、コピー元の layout_template(レイアウトテンプレート)が空文字になってしまう。

baserCMS version : 5.2.x

事前準備

以下の内容で plugins/BcThemeSample/templates/layout/sample.php レイアウトテンプレートを作成する

<!DOCTYPE html>
<html>
<head>
<?php $this->BcBaser->charset() ?>
<?php $this->BcBaser->title() ?>
</head>
<body>
<?php $this->BcBaser->content() ?>
</body>
</html>

※ 空のPHPでも問題なし

再現手順

  1. 管理画面にログインし、コンテンツ一覧(/baser/admin/contents)を開く
  2. 固定ページを新規作成し編集ページにアクセスする
  3. レイアウトテンプレートに事前準備で作成したレイアウトテンプレートを指定して保存する
  4. コンテンツ一覧(/baser/admin/contents)に戻り、3. で作成した固定ページをコピーする
  5. コピーした固定ページの編集画面にアクセスしレイアウトテンプレートが引き継がれてコピーされていないことを確認する

原因

copy() メソッド内で layout_tmplate というタイポが存在する(正しくは layout_template)。
コピー元エンティティのプロパティが存在しないため、?? 演算子により常に空文字 '' が設定される。

https://github.com/baserproject/basercms/blob/5.2.x/plugins/baser-core/src/Model/Table/PagesTable.php#L280

備考

下記のコピーメソッドにもタイポが存在する

  • baser-coreのContentFoldersTable.php
  • bc-content-linkのContentLinksTable.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions