2025-01-10 21:33:20 +03:30
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
|
|
|
|
use App\Entity\Post;
|
2025-01-11 01:29:38 +03:30
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
2025-01-10 21:33:20 +03:30
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
2025-01-11 01:29:38 +03:30
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
|
2025-01-10 21:33:20 +03:30
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
|
|
|
|
|
|
|
class PostCrudController extends AbstractCrudController
|
|
|
|
{
|
|
|
|
public static function getEntityFqcn(): string
|
|
|
|
{
|
|
|
|
return Post::class;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function configureFields(string $pageName): iterable
|
|
|
|
{
|
|
|
|
return [
|
2025-01-11 01:29:38 +03:30
|
|
|
TextField::new('title', 'عنوان'),
|
|
|
|
TextareaField::new('intro', 'خلاصه مطلب'),
|
|
|
|
TextEditorField::new('body', 'متن'),
|
2025-01-10 21:33:20 +03:30
|
|
|
];
|
|
|
|
}
|
2025-01-11 01:29:38 +03:30
|
|
|
|
|
|
|
public function configureCrud(Crud $crud): Crud
|
|
|
|
{
|
|
|
|
return $crud
|
|
|
|
// the labels used to refer to this entity in titles, buttons, etc.
|
|
|
|
->setEntityLabelInSingular('محتوا')
|
|
|
|
->setEntityLabelInPlural('محتواها')
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
2025-01-10 21:33:20 +03:30
|
|
|
}
|