src/Event/Subscriber/ExtraConfigurationSubscriber.php
private function addDefaultFilters(array &$configuration)
    {
        // Add the filters only for the "list" action
        if (!key_exists('list', $configuration['actions'])) {
            return;
        }

        // If some filters are already configured, we do not add the default filters
        if (key_exists('filter', $configuration['actions']['list'])) {
            return;
        }
        // TODO add a default unified filter
        $metadata = $this->findMetadata($configuration['entity']);

        if (null === $metadata) {
            return;
        }
        $filters = [];

        foreach ($metadata->getFieldNames() as $fieldName) {
            $type = $metadata->getTypeOfField($fieldName);
            $operator = $this->getOperatorFromFieldType($type);

            $filters[$fieldName] = [
                'type' => $type,
                'options' => [],
                'comparator' => $operator,
            ];
        }
        $configuration['actions']['list']['filters'] = $filters;
    }
private function addDefaultFilters(array &$configuration)
    {
        // Add the filters only for the "list" action
        if (!key_exists('list', $configuration['actions'])) {
            return;
        }

        // If some filters are already configured, we do not add the default filters
        if (key_exists('filter', $configuration['actions']['list'])) {
            return;
        }
        // TODO add a default unified filter
        $metadata = $this->findMetadata($configuration['entity']);

        if (null === $metadata) {
            return;
        }
        $filters = [];

        foreach ($metadata->getFieldNames() as $fieldName) {
            $type = $metadata->getTypeOfField($fieldName);
            $operator = $this->getOperatorFromFieldType($type);

            $filters[$fieldName] = [
                'type' => $type,
                'options' => [],
                'comparator' => $operator,
            ];
        }
        $configuration['actions']['list']['filters'] = $filters;
    }
private function addDefaultFilters ( array & $ configuration ) { // Add the filters only for the "list" action if ( ! key_exists ( 'list' , $ configuration [ 'actions' ] ) ) { return ; } // If some filters are already configured, we do not add the default filters if ( key_exists ( 'filter' , $ configuration [ 'actions' ] [ 'list' ] ) ) { return ; } // TODO add a default unified filter $ metadata = $ this -> findMetadata ( $ configuration [ 'entity' ] ) ; if ( null === $ metadata ) { return ; } $ filters = [ ] ; foreach ( $ metadata -> getFieldNames ( ) as $ fieldName ) { $ type = $ metadata -> getTypeOfField ( $ fieldName ) ; $ operator = $ this -> getOperatorFromFieldType ( $ type ) ; $ filters [ $ fieldName ] = [ 'type' => $ type , 'options' => [ ] , 'comparator' => $ operator , ] ; } $ configuration [ 'actions' ] [ 'list' ] [ 'filters' ] = $ filters ; }
Add default filters for the list actions, guessed using the entity metadata.

@param array $configuration
Add default filters for the list actions guessed using the entity metadata .