@@ -86,50 +86,53 @@ public function table(Table $table): Table
8686 ->modalSubmitAction (fn () => false ) // Disable the form submission
8787 ->color ('gray ' )
8888 ->icon (FilamentIcon::resolve ('actions::view-action ' ) ?? 'heroicon-m-eye ' )
89- ->infolist (fn (Infolist $ infolist ) => $ infolist
90- ->schema ([
91- TextEntry::make ('id ' )
92- ->label (__ ('inspirecms::inspirecms.id ' )),
93- TextEntry::make ('slug ' )
94- ->label (__ ('inspirecms::resources/template.slug.label ' ))
95- ->badge (),
96- TextEntry::make ('documentTypes ' )
97- ->label (__ ('inspirecms::inspirecms.document_type ' ))
98- ->getStateUsing (fn (Template | Model $ record ) => $ record ->documentTypes )
99- ->formatStateUsing (function ($ state ) {
100- if (!$ state instanceof Model) {
101- return __ ('inspirecms::inspirecms.n/a ' );
102- }
103- $ url = FilamentResourceHelper::attemptToGetUrl (
104- InspireCmsConfig::getFilamentResource ('document_type ' , DocumentTypeResource::class),
105- ['edit ' , 'view ' ],
106- ['record ' => $ state ],
107- false
108- );
109- return UIHelper::generateLink ($ state ->slug , $ url , [
110- 'target ' => '_blank ' ,
111- ]);
112- })
113- ->listWithLineBreaks (),
114- TextEntry::make ('contents ' )
115- ->label (__ ('inspirecms::inspirecms.content ' ))
116- ->getStateUsing (fn (Template | Model $ record ) => $ record ->contents )
117- ->formatStateUsing (function ($ state ) {
118- if (!$ state instanceof Model) {
119- return __ ('inspirecms::inspirecms.n/a ' );
120- }
121- $ url = FilamentResourceHelper::attemptToGetUrl (
122- InspireCmsConfig::getFilamentResource ('content ' , ContentResource::class),
123- ['edit ' , 'view ' ],
124- ['record ' => $ state ],
125- false
126- );
127- return UIHelper::generateLink ($ state ->slug , $ url , [
128- 'target ' => '_blank ' ,
129- ]);
130- })
131- ->listWithLineBreaks (),
132- ])
89+ ->infolist (
90+ fn (Infolist $ infolist ) => $ infolist
91+ ->schema ([
92+ TextEntry::make ('id ' )
93+ ->label (__ ('inspirecms::inspirecms.id ' )),
94+ TextEntry::make ('slug ' )
95+ ->label (__ ('inspirecms::resources/template.slug.label ' ))
96+ ->badge (),
97+ TextEntry::make ('documentTypes ' )
98+ ->label (__ ('inspirecms::inspirecms.document_type ' ))
99+ ->getStateUsing (fn (Template | Model $ record ) => $ record ->documentTypes )
100+ ->formatStateUsing (function ($ state ) {
101+ if (! $ state instanceof Model) {
102+ return __ ('inspirecms::inspirecms.n/a ' );
103+ }
104+ $ url = FilamentResourceHelper::attemptToGetUrl (
105+ InspireCmsConfig::getFilamentResource ('document_type ' , DocumentTypeResource::class),
106+ ['edit ' , 'view ' ],
107+ ['record ' => $ state ],
108+ false
109+ );
110+
111+ return UIHelper::generateLink ($ state ->slug , $ url , [
112+ 'target ' => '_blank ' ,
113+ ]);
114+ })
115+ ->listWithLineBreaks (),
116+ TextEntry::make ('contents ' )
117+ ->label (__ ('inspirecms::inspirecms.content ' ))
118+ ->getStateUsing (fn (Template | Model $ record ) => $ record ->contents )
119+ ->formatStateUsing (function ($ state ) {
120+ if (! $ state instanceof Model) {
121+ return __ ('inspirecms::inspirecms.n/a ' );
122+ }
123+ $ url = FilamentResourceHelper::attemptToGetUrl (
124+ InspireCmsConfig::getFilamentResource ('content ' , ContentResource::class),
125+ ['edit ' , 'view ' ],
126+ ['record ' => $ state ],
127+ false
128+ );
129+
130+ return UIHelper::generateLink ($ state ->slug , $ url , [
131+ 'target ' => '_blank ' ,
132+ ]);
133+ })
134+ ->listWithLineBreaks (),
135+ ])
133136 ),
134137 ]);
135138 }
0 commit comments