From 166e3d84466a065752b7ce58be28a5c8f4ef6611 Mon Sep 17 00:00:00 2001 From: kato Date: Fri, 20 Feb 2026 15:25:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20#4303=20=E3=80=90=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=80=91=E3=83=9E=E3=83=AB=E3=83=81=E3=83=81=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=83=9C=E3=83=83=E3=82=AF=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E5=90=84=E9=81=B8=E6=8A=9E=E8=82=A2=E3=81=8C=E8=87=AA=E5=8B=95?= =?UTF-8?q?=E3=81=A7span=E3=82=BF=E3=82=B0=E3=81=A7=E5=9B=B2=E3=81=BE?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E8=A7=A3=E6=B1=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・入力画面にヘルプも追加しています。 --- .../BcMail/Admin/element/MailFields/form.php | 12 ++++++++++++ plugins/bc-mail/src/View/Helper/MailformHelper.php | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/plugins/bc-admin-third/templates/plugin/BcMail/Admin/element/MailFields/form.php b/plugins/bc-admin-third/templates/plugin/BcMail/Admin/element/MailFields/form.php index 1820243974..b4f7460f92 100644 --- a/plugins/bc-admin-third/templates/plugin/BcMail/Admin/element/MailFields/form.php +++ b/plugins/bc-admin-third/templates/plugin/BcMail/Admin/element/MailFields/form.php @@ -247,6 +247,18 @@ class="col-head bca-form-table__label">BcAdminForm->label('opt BcAdminForm->control('options', ['type' => 'text', 'size' => 40, 'maxlength' => 255]) ?> BcAdminForm->error('options') ?> + +
+

inputタグに対してオプションを設定します。

+
+
placeholder
+
プレースホルダー:利用するには、次の形式のように | 区切りで入力します。「placeholder|プレースホルダーの内容」
+
empty
+
セレクトボックスの何も選択していないときの表示は、次の形式のように | 区切りで入力します。「empty|何も選択していないときのメッセージ」
+
templateVars.tag
+
マルチチェックボックスでそれぞれのインプットタグをラッピングする要素を指定します。例)templateVars.tag|div class="checkbox"(div class="checkbox"で囲む)
※デフォルトはspanタグでラッピングされます。
+
+
diff --git a/plugins/bc-mail/src/View/Helper/MailformHelper.php b/plugins/bc-mail/src/View/Helper/MailformHelper.php index d6530ed63a..785989e4a2 100755 --- a/plugins/bc-mail/src/View/Helper/MailformHelper.php +++ b/plugins/bc-mail/src/View/Helper/MailformHelper.php @@ -175,6 +175,20 @@ public function control(string $fieldName, array $attributes = []): string $attributes['value'] = null; $attributes['empty'] = false; $attributes['templateVars']['tag'] = 'span'; + // オプションでtemplateVars.tagが指定されていた場合の対応 + if (!empty($attributes['templateVars.tag'])) { + // 取得した値が有効なタグか確認 + $validTags = ['div', 'span', 'p', 'li', 'dt', 'dd', 'label']; + foreach ($validTags as $validTag) { + // templateVars.tagが有効なタグ名から始まっている場合、$attributes['templateVars']['tag'] にセット + if (str_starts_with($attributes['templateVars.tag'], $validTag)) { + $attributes['templateVars']['tag'] = $attributes['templateVars.tag']; + break; + } + } + // inputタグに出力されないようにunset + unset($attributes['templateVars.tag']); + } $out = $this->select($fieldName, $options, $attributes); break; case 'file': From 45fe5b9e0f17248bce2186beeb74e598c9969ba5 Mon Sep 17 00:00:00 2001 From: kato Date: Fri, 20 Feb 2026 19:23:45 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Copilot=E3=81=AE=E6=8C=87=E6=91=98=E3=82=92?= =?UTF-8?q?=E5=85=83=E3=81=AB=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/View/Helper/MailformHelper.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/bc-mail/src/View/Helper/MailformHelper.php b/plugins/bc-mail/src/View/Helper/MailformHelper.php index 785989e4a2..b0cf195594 100755 --- a/plugins/bc-mail/src/View/Helper/MailformHelper.php +++ b/plugins/bc-mail/src/View/Helper/MailformHelper.php @@ -179,11 +179,26 @@ public function control(string $fieldName, array $attributes = []): string if (!empty($attributes['templateVars.tag'])) { // 取得した値が有効なタグか確認 $validTags = ['div', 'span', 'p', 'li', 'dt', 'dd', 'label']; + $rawTemplateTag = $attributes['templateVars.tag']; foreach ($validTags as $validTag) { // templateVars.tagが有効なタグ名から始まっている場合、$attributes['templateVars']['tag'] にセット - if (str_starts_with($attributes['templateVars.tag'], $validTag)) { - $attributes['templateVars']['tag'] = $attributes['templateVars.tag']; - break; + if (str_starts_with($rawTemplateTag, $validTag)) { + // 検証済みのタグ名のみをtemplateVars['tag']にセット + $attributes['templateVars']['tag'] = $validTag; + // 先頭のタグ名以降の文字列を取得(例: ' class="checkbox"') + $rest = trim(substr($rawTemplateTag, strlen($validTag))); + if ($rest !== '') { + $rests = explode(' ', $rest); + foreach ($rests as $key => $restPart) { + // タグ名を除外した属性値の中で、onclickやonchangeなどのイベント属性が含まれている場合、unsetする + if (str_starts_with($restPart, 'on')) { + unset($rests[$key]); + } + } + if (!empty($rests) && isset($attributes['templateVars']['tag'])) { + $attributes['templateVars']['tag'] .= ' ' . implode(' ', $rests); + } + } } } // inputタグに出力されないようにunset