Skip to content

Conversation

loic425
Copy link
Member

@loic425 loic425 commented Feb 5, 2025

Fixes #230

@loic425 loic425 marked this pull request as draft February 5, 2025 08:11
@loic425 loic425 force-pushed the docs/autocompletes branch 2 times, most recently from 9d8220a to e5ae645 Compare February 5, 2025 08:16
@loic425 loic425 force-pushed the docs/autocompletes branch from e5ae645 to 2580c52 Compare February 5, 2025 08:20
@loic425 loic425 marked this pull request as ready for review February 5, 2025 08:25
{% code lineNumbers="true" %}
```php
<?php
// config/routes/ux_autocomplete.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// config/routes/ux_autocomplete.php
{% code lineNumbers="true" title="config/routes/ux_autocomplete.php" %}
```php
<?php


public static function getType(): string
{
return self::class; // it will allow to use FQCN instead of a string key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return self::class; // it will allow to use FQCN instead of a string key.
return self::class; // this will allow us to use FQCN instead of a string key.

We also need to configure the Twig template for our new grid filter.

```yaml
# config/packages/sylius_grid.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place inside a code tag
{% code lineNumbers="true" title="config/packages/sylius_grid.yaml" %}

Suggested change
# config/packages/sylius_grid.yaml
{% code lineNumbers="true" title="config/packages/sylius_grid.yaml" %}
``yaml

filter:
'App\Grid\Filter\SpeakerFilter': '@SyliusBootstrapAdminUi/shared/grid/filter/entity.html.twig'

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{% endcode %}

```

Now our new grid filtered is configured, we can use it in a grid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% code lineNumbers="true" title="src/Grid/TalkGrid.php" %}

@stlgaits
Copy link
Contributor

stlgaits commented Oct 3, 2025

I've opened a GitBook PR to replace this one : Estelle's Oct 2 changes - entity autocompletes https://app.gitbook.com/o/fmYDcx6GlpT1jw8tUL38/s/RNAi9oQYTWFv4Vn5yZFm/~/changes/23/cookbook/admin_panel/using-autocompletes/~/overview

@stlgaits stlgaits marked this pull request as draft October 3, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cookbook to add an autocomplete grid filter
2 participants