2017 © Pedro Peláez
 

library admin-bundle

Simple and extendable action-based admin management with built-in routing generation

image

sidus/admin-bundle

Simple and extendable action-based admin management with built-in routing generation

  • Monday, June 18, 2018
  • by VincentChalnot
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,930 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 20 % Grown

The README.md

Sidus/AdminBundle

The missing link between the controllers, the router component, the forms and the entities., (*1)

Example in twig:, (*2)

<a href="{{ admin_path('post', 'list') }}">List</a>
<a href="{{ entity_path(entity, 'edit') }}">Edit</a>

Warning

This bundle requires the security component of Symfony, it will enforce access to any entity using the voter. This bundle is easier to use with Doctrine, it can still be used for non-doctrine entities., (*3)

Configuration

Simple example:, (*4)

sidus_admin:
    configurations:
        post:
            entity: MyBundle\Entity\Post # Class name of your entity
            prefix: /post # Routing prefix
            controller_pattern:
                - 'Sidus\AdminBundle\Action\{{Action}}Action' # Full controller reference
            template_pattern:
                - '@SidusAdmin/Action/{{action}}.{{format}}.twig'
            actions:
                list:
                    path:     /list # Routing path
                edit:
                    path:     /edit/{id}
                    form_type: MyBundle\Form\Type\EditPostType # Form type to use in controller

Configuration reference

All values are the default one except when specified otherwise., (*5)

sidus_admin:
    admin_class: Sidus\AdminBundle\Model\Admin
    action_class: Sidus\AdminBundle\Model\Action
    configurations:
        <admin_code>:
            entity: ~ # REQUIRED: The fully qualified class name of the entity (or the Doctrine's shorter reference)
            prefix: ~ # REQUIRED: Routing prefix for all actions
            controller_pattern: [] # The controller reference that will be used to generate routing
            # Available interpolation variables are:
            # {{admin}} lowercase first letter admin code
            # {{Admin}} uppercase first letter admin code
            # {{action}} lowercase first letter action code
            # {{Action}} uppercase first letter action code
            # If you don't set any controller_pattern you will need to set the _controller attribute in the defaults of
            # each action.
            template_pattern: [] # The template pattern
            action_class: # Defaults to main action_class
            options: {} # You can put anything here
            permissions: [ ROLE_USER ] # List of permissions required to access the whole admin
            actions:
                <action_code>: # The action code needs to match the controller's method name without the "Action" suffix
                    form_type: ~ # Useful in combination with AbstractAdminController::getForm($request, $data)
                    form_options: ~ # Static form options
                    template: ~ # Computed by the TemplateResolver using template_pattern if null
                    permissions: [ ROLE_USER ] # List of permissions required to access the action
                    # All the following options are used to generate the route for the routing component
                    # See Symfony doc here: http://symfony.com/doc/current/routing.html
                    path: ~ # REQUIRED
                    defaults: ~
                    requirements: ~
                    options: ~
                    host: ~
                    schemes: ~
                    methods: ~
                    condition: ~

Usage

Generating routes

When routing to an entity, the AdminRouter component will try to fetch missing route parameters from the routing context and then from the entity itself, meaning if you name your route parameters accordingly to your entity properties, you won't need to pass any parameter manually., (*6)

PHP

<?php
/** @var $adminRouter AdminRouter */
use Sidus\AdminBundle\Routing\AdminRouter;$adminRouter->generateAdminPath('post', 'list');
$adminRouter->generateEntityPath($entity, 'edit');

When dealing with multiple admins for a single class, you can use this function instead:, (*7)

<?php
/** @var $adminRouter AdminRouter */
use Sidus\AdminBundle\Routing\AdminRouter;$adminRouter->generateAdminEntityPath('post', $entity, 'edit');

Twig

<a href="{{ admin_path('post', 'list') }}">List</a>
<a href="{{ entity_path(entity, 'edit') }}">Edit</a>

When dealing with multiple admins for a single class, you can use this function instead:, (*8)

<a href="{{ admin_entity_path('post', entity, 'edit') }}">Edit</a>

Additional optional arguments

For each method, you can pass additional route parameters in the argument just after the action name, you can also set the UrlGeneratorInterface reference type (absolute, relative...)., (*9)

<?php
/** @var $adminRouter AdminRouter */
use Sidus\AdminBundle\Routing\AdminRouter;use Symfony\Component\Routing\Generator\UrlGeneratorInterface;$adminRouter->generateAdminEntityPath(
    'post',
    $entity,
    'edit',
    ['parametrer' => 'value'],
    UrlGeneratorInterface::ABSOLUTE_PATH
);

The Versions

18/06 2018

dev-v1.3-stable

dev-v1.3-stable https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

MIT LGPL-3.0-or-later

The Requires

 

admin action

18/06 2018

v1.3.5

1.3.5.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

MIT

The Requires

 

admin action

18/06 2018

dev-v1.3-dev

dev-v1.3-dev https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

MIT GPL-2.0 LGPL-3.0-or-later

The Requires

 

admin action

30/05 2018

v1.3.4

1.3.4.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

MIT

The Requires

 

admin action

12/04 2018

v1.3.x-dev

1.3.9999999.9999999-dev https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0 LGPL-3.0-or-later

The Requires

 

admin action

12/04 2018

v1.3.3

1.3.3.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

LGPL-3.0-or-later

The Requires

 

admin action

15/03 2018

v1.3.2

1.3.2.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

LGPL-3.0-or-later

The Requires

 

admin action

14/03 2018

v1.3.1

1.3.1.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

LGPL-3.0-or-later

The Requires

 

admin action

09/01 2018

v1.3.0

1.3.0.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

31/10 2017

dev-v1.2.x-dev

dev-v1.2.x-dev https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

31/10 2017

dev-master

9999999-dev https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

11/07 2017

dev-v1.2.0-RC

dev-v1.2.0-RC https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

11/07 2017

v1.2.1

1.2.1.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

13/06 2017

v1.2.0

1.2.0.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

28/02 2017

dev-v1.1.x-dev

dev-v1.1.x-dev https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

28/02 2017

v1.1.1

1.1.1.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

15/09 2016

dev-v1.1.0-RC

dev-v1.1.0-RC https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

15/09 2016

v1.1.0

1.1.0.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action

16/03 2016

v1.0

1.0.0.0 https://github.com/VincentChalnot/SidusAdminBundle

Simple and extendable action-based admin management with built-in routing generation

  Sources   Download

GPL-2.0

The Requires

 

admin action