fix #4364 【プラグイン】カスタムコンテンツのAI用の仕様書の更新#4388
Open
kaburk wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
カスタムコンテンツ(BcCustomContent)のテンプレートで getCustomFieldValue() を使う際の、テキストエリア表示(改行処理・エスケープ)と escape => false オプションの挙動を、AI向け仕様書(Copilot Instructions)として明確化する更新です。
Changes:
- textarea フィールドのデフォルト出力が
nl2br(h())であること(改行維持+HTMLエスケープ)を明記 escape => false指定時にエスケープおよびnl2br()適用が行われず、生値が返ることと利用上の注意(XSS)を追記escape => false時に改行を反映したい場合の呼び出し側nl2br()適用例を追加
| echo $this->BcBaser->getCustomFieldValue($customEntry, 'field_name', ['escape' => false]); | ||
| ``` | ||
|
|
||
| `escape => false` にすると `nl2br()` も無効になるため、改行を `<br>` に変換したい場合は呼び出し側で `nl2br()` を適用してください。 |
|
|
||
| ## CSSの作成 | ||
| - 既存のテーマにテンプレートを追加作成する場合、CSSの作成時、Aタグの文字色は親設定を引き継いでいる可能性があるので、important を付けておく。 | ||
|
|
||
| ## その他 | ||
| - テキストエリアは h() でエスケープすると改行が<br> として表示されてしまうので使わない。 | ||
| - テキスト・テキストエリアフィールドはデフォルトで `h()` によるエスケープが有効です。 | ||
| - `escape => false` を指定すると `h()` によるエスケープを無効化できます(テキスト・テキストエリア両フィールド対応)。これにより span タグなどの HTML をそのまま出力できます。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
よろしくお願いします。