diff --git a/.gitignore b/.gitignore index f1b94a9ff..f69dfba9b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ parameters.yml Resources/node_modules/ Tests/Fixtures/App/app/config/parameters.yml +/nbproject/private/ \ No newline at end of file diff --git a/DependencyInjection/ChillPersonExtension.php b/DependencyInjection/ChillPersonExtension.php index 253948399..925aa940e 100644 --- a/DependencyInjection/ChillPersonExtension.php +++ b/DependencyInjection/ChillPersonExtension.php @@ -89,6 +89,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac public function prepend(ContainerBuilder $container) { $this->prependRoleHierarchy($container); + $this->prependHomepageWidget($container); $bundles = $container->getParameter('kernel.bundles'); //add ChillMain to assetic-enabled bundles @@ -125,6 +126,31 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac )); } + /** + * + * Add a widget "add a person" on the homepage, automatically + * + * @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container + */ + protected function prependHomepageWidget(containerBuilder $container) + { + $container->prependExtensionConfig('chill_main', array( + 'widgets' => array( + 'homepage' => array( + array( + 'widget_alias' => 'add_person', + 'order' => 2 + ) + ) + ) + )); + } + + /** + * Add role hierarchy. + * + * @param ContainerBuilder $container + */ protected function prependRoleHierarchy(ContainerBuilder $container) { $container->prependExtensionConfig('security', array( diff --git a/Resources/config/services/widgets.yml b/Resources/config/services/widgets.yml index 9d0f126ae..1d7c3c0f5 100644 --- a/Resources/config/services/widgets.yml +++ b/Resources/config/services/widgets.yml @@ -8,6 +8,6 @@ services: # this widget is defined by the PersonListWidgetFactory chill_person.widget.add_person: - class: Chill\PersonBundle\Widget\AddPersonWidget + class: Chill\PersonBundle\Widget\AddAPersonWidget tags: - { name: chill_widget, alias: add_person, place: homepage } \ No newline at end of file diff --git a/Resources/views/Widget/homepage_add_a_person.html.twig b/Resources/views/Widget/homepage_add_a_person.html.twig new file mode 100644 index 000000000..6bdbbff04 --- /dev/null +++ b/Resources/views/Widget/homepage_add_a_person.html.twig @@ -0,0 +1,8 @@ +
+ +
+ {{ 'Add a person'|trans }} +
+
+
+ diff --git a/Widget/AddAPersonWidget.php b/Widget/AddAPersonWidget.php new file mode 100644 index 000000000..a7988ed2a --- /dev/null +++ b/Widget/AddAPersonWidget.php @@ -0,0 +1,28 @@ +render("ChillPersonBundle:Widget:homepage_add_a_person.html.twig"); + } +}