kikwik/admink-bundle

Admin for Symfony 6.4

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

v0.0.3 2024-04-22 11:45 UTC

This package is auto-updated.

Last update: 2024-12-07 12:31:01 UTC


README

EXPERIMENTAL: Do not use, this is an experimental bundle

Admin by Kikwik for symfony 6.4

Installation

  1. require the bundle
#!/bin/bash
composer require kikwik/admink-bundle
  1. Import admin routes in config/routes/kikwik_admink.yaml:
kikwik_admink_bundle:
    resource: .
    type: kikwik_admink_routes
    prefix: '/admin/{_locale}'
  1. Make your admin controller extends Kikwik\AdminkBundle\Controller\AbstractCRUDController:
namespace App\Controller\Admin;

use App\Entity\Famiglia;
use App\Form\FamigliaFormType;
use Kikwik\AdminkBundle\Controller\AbstractCRUDController;
use Symfony\Component\Routing\Attribute\Route;

#[Route('/admin/{_locale}/famiglia', name: 'app_admin_famiglia')]
class FamigliaController extends AbstractCRUDController
{
    protected function getEntityClass(): string
    {
        return Famiglia::class;
    }

    protected function getListFields(): array
    {
        return [
            'nome'=> 'Nome',
            'tipo' => 'Tipo',
            'descrizione' => 'Descrizione',
            'numProdotti' => '# codici',
        ];
    }
    
    protected function getFormClass(): ?string
    {
        return FamigliaFormType::class;
    }
}
  1. Configure admin in config/packages/kikwik_admink.yaml:
kikwik_admink:
    title: 'AdminK'
    assets:
        logo: 'bundles/kikwikadmink/logo/k.png'
        favicon: 'bundles/kikwikadmink/logo/favicon.png'
    routes:
        login: 'app_login'
        logout: 'app_logout'
        change_password: 'kikwik_user_password_change'

    sidebar:
        -
            title: Prodotti
            admins:
                - { title: Famiglie, icon: bi bi-lightbulb, route: app_admin_famiglia_list }
                - { title: Codici, icon: bi bi-lightbulb-fill, route: app_admin_codice_list }
        -
            title: Attributi
            admins:
                - { title: Colori, icon: bi bi-palette, route: app_admin_colore_list }
                - { title: Materiali, icon: bi bi-bricks, route: app_admin_materiale_list }