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] Init Bootstrap admin ui getting started #131

Merged
Merged
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: 4 additions & 0 deletions docs/admin-ui/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ composer require sylius/admin-ui

## Minimalist templates

All these following templates are kind of "empty".
Copy link
Member

Choose a reason for hiding this comment

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

It probably should be rephrased, but I don't have my variant to suggest.

Suggested change
All these following templates are kind of "empty".
All these following templates are kind of "empty".


You can install the optional [BootstrapAdminUi package](../bootstrap-admin-ui/getting-started.md) to configure their contents automatically.

### Crud templates

- crud/create.html.twig
Expand Down
88 changes: 88 additions & 0 deletions docs/bootstrap-admin-ui/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,98 @@ description: >-

# Getting started

This package configures content of the [AdminUi package](../admin-ui/getting-started.md) templates.

## Installation

Install the package using Composer and Symfony Flex:

```bash
composer require sylius/bootstrap-admin-ui
```

## Configuring the CRUD templates

Content of CRUD templates is split into configurable blocks.

You are able to add new blocks, disable existing ones, or reorder them using the [TwigExtra package](../twig-extra/getting-started.md).

### Create

This package configures content of the template to create a new resource.

This adds configurable blocks into the `@SyliusAdminUi/crud/create.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Create template) --> Hook{Hook 'create'}

Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])

Content --> HookContent{Hook 'content'}

HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
HookContent --> FormErrorAlert([Form Error Alert])
HookContent --> Form([Form])
```

**Overview of the block templates**

```mermaid
flowchart LR
Template(@SyliusAdminUi/crud/create.html.twig) --> Hook{Hook 'create'}

Hook --> Sidebar([@SyliusBootstrapAdminUi/shared/crud/common/sidebar.html.twig])
Hook --> Navbar([@SyliusBootstrapAdminUi/shared/crud/common/navbar.html.twig])
Hook --> Content([@SyliusBootstrapAdminUi/shared/crud/common/content.html.twig])
```

### Index

This package configures content of the template to list resources.

This adds configurable blocks into the `@SyliusAdminUi/crud/index.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Index template) --> Hook{Hook 'index'}

Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])

Content --> HookContent{Hook 'content'}

HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
HookContent --> Grid([Grid])
```

### Show

This package configures content of the template to show resource details.

This adds configurable blocks into the `@SyliusAdminUi/crud/show.html.twig` template.

**Overview of the blocks**

```mermaid
flowchart LR
Template(Show template) --> Hook{Hook 'show'}

Hook --> Sidebar([Sidebar])
Hook --> Navbar([Navbar])
Hook --> Content([Content])

Content --> HookContent{Hook 'content'}

HookContent --> Flashes([Flashes])
HookContent --> Header([Header])
```
5 changes: 2 additions & 3 deletions docs/cookbook/admin_panel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,17 @@ return static function (ContainerConfigurator $containerConfigurator): void {
You should decorate the `sylius_admin_ui.knp.menu_builder` service to customize the admin menu.

```php
<?php

declare(strict_types=1);

namespace App\Menu;

use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Sylius\AdminUi\Knp\Menu\MenuBuilderInterface
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;

#[AsDecorator(decorates: 'sylius_admin_ui.knp.menu_builder')]
final readonly class MenuBuilder
final readonly class MenuBuilder implements MenuBuilderInterface
{
public function __construct(
private readonly FactoryInterface $factory,
Expand Down
Loading