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

[Docs] Autocomplete cookbook #231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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" %}

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