2017 © Pedro Peláez
 

symfony-bundle admin-bundle

Admin utilities for Symfony

image

zicht/admin-bundle

Admin utilities for Symfony

  • Tuesday, June 26, 2018
  • by muhammedeminakbulut
  • Repository
  • 1 Watchers
  • 1 Stars
  • 578 Installations
  • PHP
  • 4 Dependents
  • 1 Suggesters
  • 0 Forks
  • 3 Open issues
  • 100 Versions
  • 110 % Grown

The README.md

zicht/admin-bundle

Provides integration utilities for SonataAdminBundle., (*1)

Enable dump-role-hierarchy

To make this command supply you with an actual list of roles, add the following to your sonata_admin.yml:, (*2)

parameters:
    sonata.admin.security.handler.role.class: Zicht\Bundle\AdminBundle\Security\Handler\RoleSecurityHandler

sonata_admin:
    security:
        handler: sonata.admin.security.handler.role

Override Menu-events to supply other hosts

Add the following configuration to config/zicht_admin.yml to override the AdminEvents::MENU_EVENT and alter the url to a match in the list., (*3)

zicht_admin:
    menu:
        hosts:
            - site.nl.dev
            - site.nl.dev3.zicht.intern
            - a.site.nl

Duplicate entities

To duplicate an entity, add the following code: 1. In the admin of the entity you want to duplicate, add the route: protected function configureRoutes(RouteCollectionInterface $collection): void { $collection->add('duplicate'); }, (*4)

  1. In templates/bundles/SonataAdminBundle/CRUD/edit.html.twig add the duplicate button: {% if admin.hasroute('duplicate') %} <a class="btn btn-info" href="{{ admin.generateObjectUrl('duplicate', object) }}">{{ 'admin.duplicate.text_button'|trans }}</a> {% endif %} For an example, see https://github.com/zicht/zestor.nl/pull/155/files

Override entities

To also override the entities content (after duplication, see section above), add the following code: 1. Add the route in the admin so the configureRoute method becomes: protected function configureRoutes(RouteCollectionInterface $collection): void { $collection->add('duplicate'); $collection->add('override'); } 2. In the entity create the field copiedFrom (and its getter and setter). #[ORM\ManyToOne(targetEntity: Page::class)] #[ORM\JoinColumn(referencedColumnName: 'id', onDelete: 'SET NULL')] private ?Page $copiedFrom; 3. In the admin of the entity, add the override-button: if ($this->getSubject()->getCopiedFrom()) { $formMapper ->tab('admin.tab.schedule_publication') ->add( 'copiedFrom', ButtonType::class, [ 'required' => false, 'help' => $this->trans('admin.help.override', ['%copied_from%' => $this->getSubject()->getCopiedFrom()]), 'buttons' => [ 'override' => [ 'label' => 'admin.override.text_button', 'style' => 'info', 'route' => 'override', ], ], ] ) ->end() ->end(); }, (*5)

For an example, see https://github.com/zicht/zestor.nl/pull/155/files, (*6)

Quicklist

The quicklist is an autocomplete feature. In the CMS you can place this as an extra block at the dashboard to search for entities. It is also possible to use the AutocompleteType class in admin entities., (*7)

Configuration

In your project, create templates/admin/block_admin.html.twig and add this:, (*8)

{% extends sonata_block.templates.block_base %}

{% block block %}
    {{ render(controller('Zicht\\Bundle\\AdminBundle\\Controller\\QuicklistController::quicklistAction')) }}
{% endblock %}

In config/packages/zicht/admin.yaml you have the option to add multiple repositories to be searched through., (*9)

Example:, (*10)

zicht_admin:
    quicklist:
        App\Entity\Page\BiographyPage:
            repository: 'App\Entity\Page\BiographyPage'
            # choose multiple fields to search in...
            fields: ['firstName', 'lastName', 'profession']
            title: Bio
        App\Entity\Page\ArticlePage:
            repository: 'App\Entity\Page\ArticlePage'
            # ...or just one field
            fields: ['title']
            title: Article
        App\Entity\Slide:
            repository: 'App\Entity\Slide'
            fields: ['title', 'internalTitle', 'image']
            title: Slide
            # by default returns 15 results if not configured explicitly
            max_results: 100

Implementation example

namespace App\Admin;

use App\Entity\Page\BiographyPage;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Form\FormMapper;
use Zicht\Bundle\AdminBundle\Form\AutocompleteType;

class FooAdmin extends AbstractAdmin
{
    protected function configureFormFields(FormMapper $form): void
    {
        $form
            ->add('somePropertyNameHere', AutocompleteType::class, [
                'repo' => BiographyPage::class,
            ]);
    }
}

Maintainers

The Versions

26/06 2018
04/04 2018
19/02 2018
23/01 2018
25/04 2017
20/02 2017

dev-feature/fix-class-transformer-for-empty-value

dev-feature/fix-class-transformer-for-empty-value

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

29/09 2016

2.x-dev

2.9999999.9999999.9999999-dev

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

29/09 2016

2.4.1

2.4.1.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

29/09 2016

dev-feature/fixingIssueWithMultipleAdmins

dev-feature/fixingIssueWithMultipleAdmins

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

31/08 2016

3.3.x-dev

3.3.9999999.9999999-dev

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

31/08 2016

3.3.7

3.3.7.0

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

31/08 2016

3.2.x-dev

3.2.9999999.9999999-dev

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

31/08 2016
25/08 2016

2.4.0

2.4.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

25/08 2016

2.4.0-rc.2

2.4.0.0-RC2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

25/08 2016

3.3.6

3.3.6.0

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

25/08 2016
25/08 2016

2.4.0-rc.1

2.4.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

21/07 2016
21/07 2016

3.3.0

3.3.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

 

The Development Requires

by Zicht online

21/07 2016
21/07 2016
22/06 2016

3.0.0

3.0.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

19/05 2016

2.3.0

2.3.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

04/05 2016

2.3.0-rc.4

2.3.0.0-RC4

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

03/05 2016

2.3.0-rc.3

2.3.0.0-RC3

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

29/04 2016

2.3.0-rc.2

2.3.0.0-RC2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

14/04 2016

3.0.0-rc.1

3.0.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

12/04 2016

2.3.0-rc.1

2.3.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

12/04 2016

2.2.0

2.2.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

17/02 2016

2.2.0-beta.1

2.2.0.0-beta1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

20/01 2016

1.7.0

1.7.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

20/01 2016

1.7.0-rc.3

1.7.0.0-RC3

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

08/01 2016

2.1.1

2.1.1.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

08/01 2016

2.1.0

2.1.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

02/12 2015

1.7.0-rc.2

1.7.0.0-RC2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

27/10 2015

2.0.2

2.0.2.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

22/07 2015

1.7.0-rc.1

1.7.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

10/07 2015

1.1.3

1.1.3.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

07/07 2015

1.6.5

1.6.5.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

07/07 2015

1.6.4

1.6.4.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

17/06 2015

1.6.3

1.6.3.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

12/06 2015

1.6.2

1.6.2.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

08/06 2015

1.6.1

1.6.1.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

02/06 2015

1.6.0

1.6.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

28/05 2015

1.2.3-rc.1

1.2.3.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

18/05 2015

1.6.0-rc.1

1.6.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

15/05 2015

1.5.0-rc.1

1.5.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

04/05 2015

1.5.0-beta.4

1.5.0.0-beta4

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

30/04 2015

1.5.0-beta.3

1.5.0.0-beta3

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

30/04 2015

1.5.0-beta.2

1.5.0.0-beta2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

30/04 2015

1.5.0-beta.1

1.5.0.0-beta1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

26/03 2015

2.0.1

2.0.1.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

11/03 2015

1.4.0-rc.3

1.4.0.0-RC3

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

11/03 2015

1.4.0-rc.2

1.4.0.0-RC2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

11/03 2015

1.4.0-rc.1

1.4.0.0-RC1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

09/03 2015

1.3.0-beta.2

1.3.0.0-beta2

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

09/03 2015

1.3.0-beta.1

1.3.0.0-beta1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

02/02 2015

2.0.0

2.0.0.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

20/01 2015

1.2.2

1.2.2.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

15/01 2015

1.2.1

1.2.1.0

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online

08/01 2015

1.2.1-beta.1

1.2.1.0-beta1

Admin utilities for Symfony

  Sources   Download

The Requires

  • php >=5.3

 

The Development Requires

by Zicht online