Skip to content

Commit

Permalink
Merge pull request #34 from PortableStudios/feature/FILACMS-17_Relate…
Browse files Browse the repository at this point in the history
…d_content_fixes

FILACMS-17: Fix when related drop down is cleared
  • Loading branch information
kyoungportable authored Apr 15, 2024
2 parents 867866b + ede04aa commit 6a24ad6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Filament/Blocks/RelatedResourceBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace Portable\FilaCms\Filament\Blocks;

use FilamentTiptapEditor\TiptapBlock;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use FilaCms;

use Filament\Forms\Components\Group;
use Filament\Forms\Components\Repeater;

use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;

use Filament\Forms\Get;
use Filament\Forms\Set;

use FilaCms;
use FilamentTiptapEditor\TiptapBlock;
use Str;

class RelatedResourceBlock extends TiptapBlock
Expand Down Expand Up @@ -63,14 +63,17 @@ public function getFormSchema(): array
->select('id', 'title')
->where('id', $state)
->first();
$set('title', $article->title);
if($article) {
$set('title', $article->title);
}
})
->columnSpan(2),
TextInput::make('title')
->hidden()
])
->columns(3)
])
->addActionLabel('Add Another')
])
])
];
Expand Down
22 changes: 22 additions & 0 deletions views/filament/blocks/rendered/related-contents.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="border rounded">
<div class="p-4 font-bold related-block-heading border-b block">
<h3>{{ $heading }}</h3>
@php
xdebug_break();
@endphp
</div>
<div class="p-4">
<div class="flex flex-wrap gap-4">
@foreach ($selectedContents as $key => $item)
<div class="w-1/3 overflow-hidden border rounded border-md">
<a href="{{ $item['url'] }}">
<div class="px-4 py-1 uppercase semibold">{{ \Str::studly($item['source']) }}</div>
<div class="px-4 py-4">
<h4>{{ $item['source'] }}</h4>
</div>
</a>
</div>
@endforeach
</div>
</div>
</div>

0 comments on commit 6a24ad6

Please sign in to comment.