Home > OS >  EasyadminBundle : Remove some field (createdAt)
EasyadminBundle : Remove some field (createdAt)

Time:06-28

I would like to remove some fields like createAt in the crud Admin from EasyAdminBundle.

I think I can use the fields I want (code below). But is there a way to remove some fields, and include all others.

public function configureFields(string $pageName): iterable
{
    return [
        IdField::new('id'),
        TextField::new('Nom'),
        TextEditorField::new('description'),
    ];
}

CodePudding user response:

You can specify the fields and exclude these you don't want like this:

    public function configureFields(string $pageName): iterable
     {
        yield TextField::new('taskitemtext', 'Task');
        yield NumberField::new('flag', 'Flag');
        yield BooleanField::new('isdone', 'Done?');
        yield DateTimeField::new('date', 'Deadline')->setFormTypeOptions([
            'html5' => false,
            'widget' => 'single_text',
        ]);

this will show only those that are listed.

  • Related