elkex
03/08/2023, 3:26 PMifox
03/08/2023, 3:30 PMifox
03/08/2023, 3:31 PMelkex
03/08/2023, 3:43 PMelkex
03/08/2023, 3:43 PMelkex
03/08/2023, 3:48 PMelkex
03/08/2023, 3:49 PMifox
03/08/2023, 3:58 PMelkex
03/08/2023, 4:09 PMKoili
03/09/2023, 9:13 AMmedias
form field?
my usecase would be validating that a block-editor block with a medias form field, has at least X amount of images attached in a single medias
form field
Something along the lines of this:
php
@twillBlockValidationRules([
'medias.cover' => [
'required',
'min:12'
],
])
EDIT:
Nevermind I figured out how to target the medias.cover properly. Ended up using this:
php
@twillBlockValidationRules([
'cover' => [
'required',
'array',
'between:12,16'
],
])
where the medias form field name is cover
david HUN
03/09/2023, 9:40 AMdavid HUN
03/09/2023, 9:42 AMjefsev
03/09/2023, 10:51 AMifox
03/09/2023, 10:51 AMafterSave
on a module repository, or globally using the EventServiceProvider. The cms-module.save
event is triggered any time you make a change. So you can listen to that event and trigger the command.ifox
03/09/2023, 10:52 AMBladePartial
for thatjefsev
03/09/2023, 10:56 AMdavid HUN
03/09/2023, 10:57 AMjefsev
03/09/2023, 11:03 AMifox
03/09/2023, 11:17 AMBladePartial::make()->view('view')->withAdditionalParams([...])
ifox
03/09/2023, 11:18 AMjefsev
03/09/2023, 12:04 PMjefsev
03/09/2023, 12:04 PMelkex
03/09/2023, 1:29 PMprotected $showOnlyParentItemsInBrowsers = true;
protected $nestedItemsDepth = 3;
protected function form($id, $item = null)
{
$item = $this->repository->getById($id, $this->formWith, $this->formWithCount);
$this->permalinkBase = $item->ancestorsSlug;
return parent::form($id, $item);
}
And I also added the following to the frontend controller:
$page = app(PageRepository::class)->forNestedSlug($slug);
However it still only returns my top slug..ifox
03/09/2023, 1:30 PMelkex
03/09/2023, 1:31 PMifox
03/09/2023, 1:34 PMMarcin
03/09/2023, 1:34 PMelkex
03/09/2023, 1:38 PM$page = app(PageRepository::class)->forNestedSlug($slug);
And therefor it does not know it is a child..feelgoodinc
03/09/2023, 1:58 PMkalle
03/09/2023, 2:11 PM