-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Short description of what this feature will allow to do:
Add addDisplayOnPage(string $pageName) in src/Field/FieldTrait.php
Adding the addDisplayOnPage(string $pageName) method to the src/Field/FieldTrait.php trait allows adding a field to a "page" other than EDIT INDEX DETAIL NEW. These other pages can be, for example, CSV or WHATEVER.
Example of how to use this feature
#src/Controller/Admin/MyCrudController.php
[...]
public function configureFields(string $pageName): iterable
{
yield TextField::new('field')
->addDisplayOnPage("CSV")
->hideOnIndex()->hideOnForm()->hideOnDetail();
}
# And in another method, We retrieve only fields of CSV PAGE
public function export(AdminContext $context): Response
{
//
$context->getCrud()->setPageName("CSV");
//
}