Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] On detail page allow field to occupy full width of tab #5612

Open
wants to merge 7 commits into
base: 4.x
Choose a base branch
from

Conversation

ksn135
Copy link
Contributor

@ksn135 ksn135 commented Feb 6, 2023

The main purpose of this feature is to allow the user to use all the space of a separate tab on the detail page, as well as to get the necessary data for displaying from the controller.

// src/Controller/SomeCrudController.php
class SomeCrudController extends AbstractCrudController
{
   ...
    public function configureFields(string $pageName): iterable
    {
       ...
        yield FormField::addTab('Map', 'fa fa-solid fa-map')->onlyOnDetail();
        yield SpecialMapField::new('map')
             ->setTemplatePath('crud/field/map.html.twig')
             ->setWithTwigContext()
             ->setFullWidth()
             ->onlyOnDetail()
       ;
    }
    
    public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
    {
        if (Crud::PAGE_DETAIL === $responseParameters->get('pageName')) {
            $responseParameters->set('mapPOI', $this->poiManager->getPOIAsArray());
            $responseParameters->set('targetName', 'Some name');
            ...
        }
        
        return $responseParameters;
    }
...   
}

Screenshot 2023-02-06 at 14 42 33

PS: Based on original idea @lukasluecke from /issues/3518

@javiereguiluz javiereguiluz added this to the 4.x milestone Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants