Commit f5e5c963 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Mise à jour de l'exemple de formulaire multipage (nouvelle bib unicaen/mutlipage-form)

parent 9bbbe255
Loading
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -2,18 +2,16 @@

namespace Exemple;

use Laminas\Http\Request as HttpRequest;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
use Laminas\Http\Request as HttpRequest;
use Laminas\Session\SessionManager;
use Laminas\Stdlib\ArrayUtils;

class Module
{
    public function onBootstrap(MvcEvent $e)
    public function onBootstrap(MvcEvent $e): void
    {
        $application = $e->getApplication();
        $serviceManager = $application->getServiceManager();
        $serviceManager->get('translator');
        $eventManager = $application->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);
@@ -27,18 +25,18 @@ class Module
                }
            }
        );

        // The following line instantiates the SessionManager and automatically
        // makes the SessionManager the 'default' one.
//        $serviceManager->get(SessionManager::class);
    }

    public function getConfig()
    public function getConfig(): array
    {
        return include __DIR__ . '/config/module.config.php';
        return ArrayUtils::merge(
            include __DIR__ . '/config/module.config.php',
            include __DIR__ . '/config/multipage-form.config.php',
            true
        );
    }

    public function getAutoloaderConfig()
    public function getAutoloaderConfig(): array
    {
        return [
            'Laminas\Loader\StandardAutoloader' => [
+27 −26
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@
  "require": {
    "php": "^8.0",
    "unicaen/app": "^6.0",
        "unicaen/bjy-authorize":         "^6.0"
    "unicaen/bjy-authorize": "^6.0",
    "unicaen/multipage-form": "dev-master"
  },
  "extra": {
    "branch-alias": {
+17 −73
Original line number Diff line number Diff line
@@ -2,15 +2,14 @@

namespace Exemple;

use Exemple\Controller\ContactController;
use Exemple\Controller\IndexController;
use Laminas\ServiceManager\Factory\InvokableFactory;

return [
    'bjyauthorize' => [
        'guards' => [
            'BjyAuthorize\Guard\Controller' => [
                ['controller' => IndexController::class, 'roles' => 'guest'],
                ['controller' => ContactController::class, 'roles' => 'guest'],
                ['controller' => IndexController::class, 'roles' => []],
            ],
        ],
    ],
@@ -20,46 +19,13 @@ return [
            'exemple' => [
                'type' => 'Literal',
                'options' => [
                    'route'    => '/exemple',
                    'route' => '/exemple/accueil',
                    'defaults' => [
                        'controller' => IndexController::class,
                        'action' => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes'  => [
                    'contact' => [
                        'type'          => 'Literal',
                        'options'       => [
                            'route'    => '/contact',
                            'defaults' => [
                                'controller' => ContactController::class,
                                'action' => 'index',
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes'  => [
                            'default' => [
                                'type'    => 'Segment',
                                'options' => [
                                    'route'       => '/:action',
                                    'constraints' => [
                                        /**
                                         * @see ContactController::ajouterAction()
                                         * @see ContactController::ajouterIdentiteAction()
                                         * @see ContactController::ajouterAdresseAction()
                                         * @see ContactController::ajouterMessageAction()
                                         * @see ContactController::ajouterAnnulerAction()
                                         * @see ContactController::ajouterConfirmerAction()
                                         * @see ContactController::ajouterEnregistrerAction()
                                         */
                                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
@@ -73,39 +39,17 @@ return [
                        'route' => 'exemple',
                        'icon' => 'glyphicon glyphicon-cog',
                        'pages' => [
                            'contact' => [
                                'label' => 'Formulaire multipage',
                                'route' => 'exemple/contact/default',
                                'action' => 'ajouter'
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'service_manager' => [
        'factories' => [

                        ],
                    ],

    'translator'      => [
        'locale'                    => 'fr_FR', // en_US
        'translation_file_patterns' => [
            [
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
                ],
            ],
        ],
    ],

    'controllers' => [
        'invokables' => [
            IndexController::class => IndexController::class,
            ContactController::class => ContactController::class,
        'factories' => [
            IndexController::class => InvokableFactory::class,
        ],
    ],

+79 −0
Original line number Diff line number Diff line
<?php

namespace Exemple;

use Exemple\MultipageForm\Controller\ContactController;

return [
    'bjyauthorize' => [
        'guards' => [
            'BjyAuthorize\Guard\Controller' => [
                ['controller' => ContactController::class, 'roles' => []],
            ],
        ],
    ],

    'router' => [
        'routes' => [
            'exemple' => [
                'child_routes' => [
                    'contact' => [
                        'type' => 'Literal',
                        'options' => [
                            'route' => '/contact',
                            'defaults' => [
                                'controller' => ContactController::class,
                                'action' => 'index',
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes' => [
                            'default' => [
                                'type' => 'Segment',
                                'options' => [
                                    'route' => '/:action',
                                    'constraints' => [
                                        /**
                                         * @see ContactController::ajouterAction()
                                         * @see ContactController::ajouterIdentiteAction()
                                         * @see ContactController::ajouterAdresseAction()
                                         * @see ContactController::ajouterMessageAction()
                                         * @see ContactController::ajouterAnnulerAction()
                                         * @see ContactController::ajouterConfirmerAction()
                                         * @see ContactController::ajouterEnregistrerAction()
                                         */
                                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'navigation' => [
        'default' => [
            'home' => [
                'pages' => [
                    'exemple' => [
                        'pages' => [
                            'contact' => [
                                'label' => 'Formulaire multipage',
                                'route' => 'exemple/contact/default',
                                'action' => 'ajouter'
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'controllers' => [
        'invokables' => [
            ContactController::class => ContactController::class,
        ],
    ],
];

language/en_US.mo

deleted100755 → 0
−545 B

File deleted.

Loading