Ejecutar el comando por consola
php composer.phar require mwsimple/admin-crud
Agregar a la clase app/AppKernel.php
:
// ...
new MWSimple\Bundle\AdminCrudBundle\MWSimpleAdminCrudBundle(),
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new SC\DatetimepickerBundle\SCDatetimepickerBundle(),
new Liip\ImagineBundle\LiipImagineBundle(),
new Tetranz\Select2EntityBundle\TetranzSelect2EntityBundle(),
new Vich\UploaderBundle\VichUploaderBundle(),
// new FOS\CKEditorBundle\FOSCKEditorBundle(),
Para instanciar VichUploaderBundle descomentar y Ver: Subiendo archivos
Para instanciar FOSCKEditorBundle descomentar y Ver: Formularios Editor de texto
En el archivo app/config/config.yml
imports:
...
- { resource: "@MWSimpleAdminCrudBundle/Resources/config/config.yml" }
framework:
...
translator: { fallback: %locale% } # uncomment line
En caso de necesitar mayor configuración: LexikFormFilterBundle
En el archivo app/config/config.yml
knp_paginator:
page_range: 10 # default page range used in pagination control
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
sort_direction_name: direction # sort direction query parameter name
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
template:
# pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig # bootstrap 3 sliding pagination controls template
pagination: MWSimpleAdminCrudBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig # bootstrap 3 sliding pagination controls template
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template
knp_menu:
twig: # use "twig: false" to disable the Twig extension and the TwigRenderer
template: MWSimpleAdminCrudBundle:Menu:knp_menu.html.twig
templating: false # if true, enables the helper for PHP templates
default_renderer: twig # The renderer to use, list is also available by default
#setting:
#- site_theme: Permite configurar tema. [Ver Temas](http://bootswatch.com/default/)
#- site_name: Permite configurar el nombre.
#- site_view_layout: Permite configurar el layout a extender por el CRUD.
#- site_view_footer: Permite configurar el footer a incluir por el CRUD.
#- fos_user: Poner a true en caso de utilizar FosUserBundle.
#- one_page: Poner a true, convierte el CRUD en una sola página utilizando AJAX.
#- use_pace: Poner a true, agrega pace js.
#- use_ckeditor: Poner a true, agrega ckeditor js.
#- menu_horizontal: Para menu horizontal poner en true. Ademas agregar en menu_setting.class: nav navbar-nav
#menu: Los child son índices no deben ser iguales, aquí se agregan y configuran los item del menu.
#menu: Permite configurar el nombre, url, id, icono, roles a quien visualiza, si tiene submenu se puede agregar.
mw_simple_admin_crud:
setting: { site_name: Administración, fos_user: false, one_page: true, use_pace: true } # Default:: site_theme: bootstrap, site_name: AdminCrud, site_view_layout: 'MWSimpleAdminCrudBundle::layout.html.twig', site_view_footer: '::footer.html.twig', fos_user: false, one_page: false, use_pace: false, use_ckeditor: false, menu_horizontal: false
menu_setting: { id: side-menu, class: nav } # use id: side-menu and class: nav. If is horizontal use class: nav navbar-nav
menu:
child: { name: inicio, url: mws_admin_crud_menu, id: inicio, icon: glyphicon glyphicon-home }
#child2:
# name: help
# url: null
# id: help
# subMenu:
# indice:
# name: indice
# url: admin_indice
# icon: glyphicon glyphicon-home
# roles: ['ROLE_ADMIN']
# roles: ['ROLE_USER']
#child3: { name: Usuarios, url: admin_usuario, id: usuario, roles: ['ROLE_SUPERADMIN'], icon: glyphicon glyphicon-user }
vich_uploader:
db_driver: orm
En el archivo app/config/routing.yml
incluye http://symfony.com/doc/current/routing/redirect_trailing_slash.html
mw_simple_admin_crud:
resource: "@MWSimpleAdminCrudBundle/Controller/"
type: annotation
prefix: /admin
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
# DEBE IR AL FINAL
remove_trailing_slash:
path: /{url}
defaults: { _controller: MWSimpleAdminCrudBundle:Redirecting:removeTrailingSlash }
requirements:
url: .*\/$
_method: GET
php bin/console assets:install