Skip to content

Commit

Permalink
カスタムコンテンツのフィールドタイプでヘルパが定義されていない場合に例外を投げるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Jan 10, 2025
1 parent ae10652 commit ff353b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ public function control(CustomLink $customLink, array $options = []): string
*/
public function preview(string $fieldName, string $type, CustomField $field): string
{
if(is_null($this->{$type})) {
throw new BcException(__d('baser_core', 'ヘルパー "{0}Helper" を定義してください', $type));
}
if (method_exists($this->{$type}, 'preview')) {
return $this->{$type}->preview(new CustomLink([
'name' => $fieldName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace BcCustomContent\View\Helper;

use BaserCore\Error\BcException;
use BaserCore\Model\Entity\Content;
use BaserCore\Utility\BcContainerTrait;
use BaserCore\View\Helper\BcBaserHelper;
Expand Down Expand Up @@ -82,6 +83,8 @@ public function loadPluginHelper(): void
"$plugin",
['className' => "$plugin.$plugin"]
);
} else {
throw new BcException(__d('baser_core', 'ヘルパー "{0}Helper" を定義してください', $plugin));
}
}
}
Expand Down

0 comments on commit ff353b0

Please sign in to comment.