#Rich Content Render is not working for me

6 messages · Page 1 of 1 (latest)

candid sluice
#

Hello everyone. I'm a beginner using filament so this might just be something very simple and laughable but I can't seem to wrap my head around how to go about it.
I was trying to use Rich Text Editor that filament provides but when I'm trying to display the Rich text content using RichContentRenderer, from the infolist, I encounter the attached error.

I think it's probably just me doing it wrong but can anyone tell me how they go about using the RichEditor and display the content in the view using RichContentRenderer so I can follow the example?

atomic needleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

candid sluice
#

Here's the code to my ConferenceResource file:

<?php

namespace App\Filament\Resources\Conferences;

use App\Filament\Resources\Conferences\Pages\CreateConference;
use App\Filament\Resources\Conferences\Pages\EditConference;
use App\Filament\Resources\Conferences\Pages\ListConferences;
use App\Filament\Resources\Conferences\Pages\ViewConference;
use App\Filament\Resources\Conferences\Schemas\ConferenceForm;
use App\Filament\Resources\Conferences\Tables\ConferencesTable;
use App\Filament\Resoures\Conferences\Schemas\ConferenceInfolist;
use App\Models\Conference;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class ConferenceResource extends Resource
{
    protected static ?string $model = Conference::class;

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;

    protected static ?string $recordTitleAttribute = 'Conference';

    public static function form(Schema $schema): Schema
    {
        return ConferenceForm::configure($schema);
    }

    public static function table(Table $table): Table
    {
        return ConferencesTable::configure($table);
    }

   public static function infolist(Schema $schema): Schema{
        return ConferenceInfolist::configure($schema);
   }

    public static function getRelations(): array
    {
        return [
            //
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListConferences::route('/'),
            'create' => CreateConference::route('/create'),
            'view' => ViewConference::route('/{record}'),
            'edit' => EditConference::route('/{record}/edit'),
        ];
    }
}
#

Here's my ViewConference.php file:

<?php

namespace App\Filament\Resources\Conferences\Pages;

use App\Filament\Resources\Conferences\ConferenceResource;
use Filament\Actions\EditAction;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Schema;

class ViewConference extends ViewRecord
{
    protected static string $resource = ConferenceResource::class;
    protected function getHeaderActions(): array
    {
        return [
            EditAction::make(),
        ];
    }
}

Here's my ConferenceInfolist.php

<?php

namespace App\Filament\Resoures\Conferences\Schemas;

use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Schema;

class ConferenceInfolist
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextEntry::make('name'),
                RichContentRenderer::make($record->description),
            ]);
    }
}

lavish island
#

It shows you the error, your are calling $record without it exisiting within the infolist schema put it in a closure:

components(fn($record) => [ 
candid sluice