Skip to content

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