fbeen/adminbundle

Bootstrap easy to config admin

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

dev-master 2019-11-17 00:06 UTC

This package is not auto-updated.

Last update: 2024-12-23 11:07:53 UTC


README

This bundle is under development!

/config/routes.yaml

# fbeen-admin
admin_area:
    resource: "@FbeenAdminBundle/Resources/config/routing.yaml"
    prefix: /testje

/src/Admin/ContactAdmin.yaml

<?php

namespace App\Admin;

use Symfony\Component\OptionsResolver\OptionsResolver;
use Fbeen\AdminBundle\Admin\AbstractAdmin;
use App\Entity\Contact;

/**
 * Description of ContactAdmin
 *
 * @author Frank Beentjes <frankbeen@gmail.com>
 */
class ContactAdmin extends AbstractAdmin
{
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'entity' => Contact::class,
            'label' => 'Contactverzoeken',
            'icon' => 'fas fa-phone-volume',
            'slug' => 'contactverzoeken',
        ]);
    }
    
    protected function configureListFields(ListMapper $listMapper): void
    {
        $listMapper
            ->addIdentifier('__toString', null, ['label' => 'Adres'])
            ->add('description', null, ['label' => 'Zoeknaam'])
            ->add('_action', null, [
                'actions' => [
                    'show' => [],
                    'edit' => [],
                    'delete' => [],
                ],
            ]);
    }
}

config/services.yaml


    # admins are imported separately to make sure services can be injected
    # as action arguments even if you don't extend any base admin class
    App\Admin\:
        resource: '../src/Admin'
        tags: ['fbeen.admin']