Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/cookbook/admin_panel/basic_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ final class BookGrid extends AbstractGrid implements ResourceAwareGridInterface
{
$gridBuilder
// see https://github.com/Sylius/SyliusGridBundle/blob/master/docs/field_types.md
->addField(
->withFields(
StringField::create('title')
->setLabel('Title')
->setSortable(true),
)
->addField(
StringField::create('author')
->setLabel('Author')
->setSortable(true),
Expand Down
32 changes: 11 additions & 21 deletions docs/cookbook/admin_panel/grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,21 @@ final class TalkGrid extends AbstractGrid
{
$gridBuilder
// see https://github.com/Sylius/SyliusGridBundle/blob/master/docs/field_types.md
->addField(
->withFields(
StringField::create('title')
->setLabel('Title')
->setSortable(true)
)
->addField(
->setSortable(true),
StringField::create('description')
->setLabel('Description')
->setSortable(true)
)
->addField(
->setSortable(true),
DateTimeField::create('startsAt')
->setLabel('StartsAt')
)
->addField(
->setLabel('StartsAt'),
DateTimeField::create('endsAt')
->setLabel('EndsAt')
)
->addField(
->setLabel('EndsAt'),
StringField::create('track')
->setLabel('Track')
->setPath('track.value')
->setSortable(true)
->setSortable(true),
)
->addActionGroup(
MainActionGroup::create(
Expand Down Expand Up @@ -125,14 +117,12 @@ final class TalkGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
StringField::create('title')
->setLabel('Title')
->setSortable(true)
)
->addField(
->setSortable(true),
DateTimeField::create('startsAt')
->setLabel('StartsAt')
->setLabel('StartsAt'),
)
->addActionGroup(
MainActionGroup::create(
Expand Down Expand Up @@ -189,7 +179,7 @@ final class TalkGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
TwigField::create('avatar', 'talk/grid/field/speaker_avatar.html.twig')
->setPath('.')
->setLabel('app.ui.avatar'),
Expand Down Expand Up @@ -317,7 +307,7 @@ final class TalkGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addFilter(
->withFilters(
Filter::create(name: 'speaker', type: SpeakerFilter::class)
->setLabel('app.ui.speaker')
->setOptions(['fields' => ['speaker.id']])
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/admin_panel/using-autocompletes.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ final class TalkGrid extends AbstractGrid
{
$gridBuilder
// ...
->addFilter(
->withFilters(
Filter::create(name: 'speaker', type: SpeakerFilter::class)
->setLabel('app.ui.speaker')
->setOptions(['fields' => ['speakers.id']]),
Expand Down
6 changes: 2 additions & 4 deletions docs/cookbook/ddd_architecture/grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ final class BookGrid extends AbstractGrid implements ResourceAwareGridInterface
{
$gridBuilder
->setProvider(BookGridProvider::class) // The Grid provider we have just created
->addField(
StringField::create('name')
)
->addField(
->withFields(
StringField::create('name'),
StringField::create('author'),
)
->addActionGroup(
Expand Down
4 changes: 2 additions & 2 deletions docs/grid/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ return static function (GridConfig $grid): void {
->setRepositoryMethod('myCustomMethod', ['id' => 'resource.id'])
->orderBy('name', 'asc')
->setLimits([10, 25, 50, 100])
->addField(
->withFields(
Field::create('name', 'twig') // Name & Type of field
->setLabel('Name') // # Label
->setPath('.') // dot means a whole object
Expand All @@ -184,7 +184,7 @@ return static function (GridConfig $grid): void {
])
->setEnabled(true)
)
->addFilter(
->withFilters(
Filter::create('name', 'string') // Name & Type of filter
->setLabel('app.ui.name')
->setEnabled(true)
Expand Down
4 changes: 2 additions & 2 deletions docs/grid/custom_field_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid) {
$grid->addGrid(GridBuilder::create('app_admin_supplier', Supplier::class)
->addField(
->withFields(
Field::create('name', 'custom')
->setLabel('sylius.ui.name')
)
Expand Down Expand Up @@ -124,7 +124,7 @@ final class AdminSupplierGrid extends AbstractGrid implements ResourceAwareGridI
public function buildGrid(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
Field::create('name', 'custom')
->setLabel('sylius.ui.name')
)
Expand Down
4 changes: 2 additions & 2 deletions docs/grid/custom_filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid) {
$grid->addGrid(GridBuilder::create('app_tournament', Tournament::class)
->addFilter(
->withFilters(
Filter::create('stats', 'suppliers_statistics')
->setFormOptions(['range' => [0, 100]])
)
Expand Down Expand Up @@ -233,7 +233,7 @@ final class TournamentGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addFilter(
->withFilters(
Filter::create('stats', 'suppliers_statistics')
->setFormOptions(['range' => [0, 100]])
)
Expand Down
16 changes: 8 additions & 8 deletions docs/grid/field_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class UserGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
StringField::create('email')
->setLabel('app.ui.email') // # each field type can have a label, we suggest using translation keys instead of messages
->setPath('contactDetails.email')
Expand Down Expand Up @@ -71,7 +71,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid): void {
$grid->addGrid(GridBuilder::create('app_user', '%app.model.user.class%')
->addField(
->withFields(
StringField::create('email')
->setLabel('app.ui.email') // # each field type can have a label, we suggest using translation keys instead of messages
->setPath('contactDetails.email')
Expand Down Expand Up @@ -119,7 +119,7 @@ final class UserGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
DateTimeField::create('birthday', 'Y:m:d H:i:s', null) // this format and timezone are the default value, but you can modify them
->setLabel('app.ui.birthday')
)
Expand Down Expand Up @@ -158,7 +158,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid): void {
$grid->addGrid(GridBuilder::create('app_user', '%app.model.user.class%')
->addField(
->withFields(
DateTimeField::create('birthday', 'Y:m:d H:i:s', null) // this format and timezone are the default value, but you can modify them
->setLabel('app.ui.birthday')
)
Expand Down Expand Up @@ -211,7 +211,7 @@ final class UserGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
TwigField::create('name', ':Grid/Column:_prettyName.html.twig')
->setLabel('app.ui.name')
)
Expand Down Expand Up @@ -249,7 +249,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid): void {
$grid->addGrid(GridBuilder::create('app_user', '%app.model.user.class%')
->addField(
->withFields(
TwigField::create('name', '@Grid/Column/_prettyName.html.twig')
->setLabel('app.ui.name')
)
Expand Down Expand Up @@ -297,7 +297,7 @@ final class UserGrid extends AbstractGrid
public function __invoke(GridBuilderInterface $gridBuilder): void
{
$gridBuilder
->addField(
->withFields(
TwigField::create('name', ':Grid/Column:_prettyName.html.twig')
->setLabel('app.ui.name')
->setPath('.') // sets the field path to the root object
Expand Down Expand Up @@ -335,7 +335,7 @@ use Sylius\Bundle\GridBundle\Config\GridConfig;

return static function (GridConfig $grid): void {
$grid->addGrid(GridBuilder::create('app_user', '%app.model.user.class%')
->addField(
->withFields(
TwigField::create('name', '@Grid/Column/_prettyName.html.twig')
->setLabel('app.ui.name')
->setPath('.') // sets the field path to the root object
Expand Down
Loading