Skip to content

Commit ae10652

Browse files
committed
カスタムコンテンツのフィールドタイプでヘルパが定義されていない場合に例外を投げるようにした
1 parent dc8f605 commit ae10652

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plugins/bc-custom-content/src/View/Helper/CustomContentAdminHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace BcCustomContent\View\Helper;
1313

14+
use BaserCore\Error\BcException;
1415
use BaserCore\Utility\BcUtil;
1516
use BaserCore\View\Helper\BcAdminFormHelper;
1617
use BcCustomContent\Model\Entity\CustomEntry;
@@ -184,6 +185,9 @@ public function control(CustomLink $customLink, array $options = []): string
184185
*/
185186
public function preview(string $fieldName, string $type, CustomField $field): string
186187
{
188+
if(is_null($this->{$type})) {
189+
throw new BcException(__d('baser_core', 'ヘルパー "{0}Helper" を定義してください', $type));
190+
}
187191
if (method_exists($this->{$type}, 'preview')) {
188192
return $this->{$type}->preview(new CustomLink([
189193
'name' => $fieldName,

0 commit comments

Comments
 (0)