Skip to content

Conversation

vasilvestre
Copy link
Contributor

No description provided.

@vasilvestre vasilvestre force-pushed the doc/as-grid branch 3 times, most recently from 4d1a866 to 22e9c0d Compare June 6, 2025 07:33

Now we can configure our first grid:

{% tabs %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure it's not too early to entirely remove these two tabs ? Couldn't we just mark them as "YAML (Legacy)" and "PHP (Legacy)" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed with @loic425 , "your first grid" is king of a "get started" and should promote best practice

Copy link
Member

Choose a reason for hiding this comment

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

Cannot we just put php service grid in the first place? Yaml/Php configs aren't event officially deprecated yet

Copy link
Member

Choose a reason for hiding this comment

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

yeah, good idea, just put in on the first position.

@stlgaits
Copy link
Contributor

stlgaits commented Jun 6, 2025

Just a general note on how the page is structured: since we’re showing both the attribute-based and the legacy (configuration-based) approaches, I think it would be helpful to add a sentence at the very top of the page or just below each section title to make it clear that this is an either/or situation.
For example, something like :

Attributes

`To create your custom filter, you can leverage Sylius’s #[AsFilter] attribute which provides a convenient, native way to configure filters directly in your code.

Legacy way

The legacy service-based approach is still documented below in case you're maintaining an older setup.

@vasilvestre vasilvestre requested review from a team and diimpp June 6, 2025 14:14
@vasilvestre
Copy link
Contributor Author

Kindly ask for your insights @diimpp 🙏🏻

@vasilvestre vasilvestre requested a review from stlgaits June 6, 2025 14:27

Now we can configure our first grid:

{% tabs %}
Copy link
Member

Choose a reason for hiding this comment

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

Cannot we just put php service grid in the first place? Yaml/Php configs aren't event officially deprecated yet


{% code title="templates/Grid/Filter/suppliers_statistics.html.twig" lineNumbers="true" %}
```twig
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
Copy link
Member

Choose a reason for hiding this comment

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

That's a sylius v1 code, stack has it's own bootstrap form theme.

This one I think
https://github.com/Sylius/Stack/blob/main/src/BootstrapAdminUi/templates/shared/form_theme.html.twig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wdyt @loic425 ?

Copy link
Member

Choose a reason for hiding this comment

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

yes, this code is outdated. @diimpp is right.

public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add(
'stats',
Copy link
Member

Choose a reason for hiding this comment

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

I understand stats existed in the examples before, but it's hard to read. Does it mean days, count, limit? A thought for future to improve it somehow.

Adds a new tab to the documentation showcasing how to define a grid using attributes.

doc: adds a custom filter for Sylius Grid

Adds a new custom filter for Sylius Grid, demonstrating how to create a filter class and its associated form type.

Co-authored-by: Estelle Gaits <[email protected]>

Co-authored-by: Dmitri Perunov <[email protected]>
Update
use Sylius\Bundle\GridBundle\Grid\AbstractGrid;
use Sylius\Bundle\GridBundle\Grid\ResourceAwareGridInterface;

#[AsGrid('app_tournament', Tournament::class)]
Copy link
Member

Choose a reason for hiding this comment

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

please use named arguments.

@loic425 loic425 changed the title doc : Document new attributs, AsGrid and AsFilter doc : Document new attributes, AsGrid and AsFilter Sep 26, 2025
@stlgaits
Copy link
Contributor

I'm rewriting this doc PR in Gitbook, I will split it into at least 2 separate PRs for clarity.
Part 1 : https://app.gitbook.com/o/fmYDcx6GlpT1jw8tUL38/s/RNAi9oQYTWFv4Vn5yZFm/~/changes/25/~/overview

@stlgaits stlgaits marked this pull request as draft October 15, 2025 09:11
@stlgaits stlgaits added documentation Improvements or additions to documentation do not merge This PR shouldn't be merged yet labels Oct 15, 2025
@stlgaits
Copy link
Contributor

@stlgaits stlgaits closed this Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge This PR shouldn't be merged yet documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants