Skip to content

Commit

Permalink
テーマ設定の「リンク先URL」欄のルートパスやnullがエラーになる。
Browse files Browse the repository at this point in the history
  • Loading branch information
IwasakiRyuichi committed Jan 24, 2025
1 parent 4639019 commit 6557809
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ public function validationKeyValue(Validator $validator): Validator

$validator->add('logo_link', [
'urlCheck' => [
'rule' => ['url', true],
'rule' => function ($value, $context) {
// 空白またはルートパス(/)の場合はバリデーションをスキップ
if (empty($value) || $value === '/') {
return true;
}
// それ以外の場合はURL形式をチェック
return filter_var($value, FILTER_VALIDATE_URL) !== false;
},
'message' => __d('baser_core', '無効なURLです')
]
]);
Expand Down

0 comments on commit 6557809

Please sign in to comment.