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
@@ -40,57 +40,6 @@ $ bin/console make:grid

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

@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 diimpp and a team 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
@@ -40,57 +40,6 @@ $ bin/console make:grid

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 <74190794+stlgaits@users.noreply.github.com>

Co-authored-by: Dmitri Perunov <diimpp@gmail.com>
Update
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.

4 participants