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

MutlipageForm : typages, suppression de commentaires inutiles.

parent b0a8dbdf
Loading
Loading
Loading
Loading
+74 −199
Original line number Diff line number Diff line
@@ -2,10 +2,8 @@

namespace UnicaenApp\Controller\Plugin;

use UnicaenApp\Controller\Plugin\Exception\IllegalStateException;
use UnicaenApp\Form\Fieldset\MultipageFormNavFieldset;
use UnicaenApp\Form\MultipageForm;
use Laminas\Form\Fieldset;
use Laminas\Form\FieldsetInterface;
use Laminas\Http\PhpEnvironment\Request;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\Plugin\AbstractPlugin;
@@ -13,6 +11,9 @@ use Laminas\Mvc\MvcEvent;
use Laminas\Mvc\Plugin\Prg\PostRedirectGet;
use Laminas\Router\Http\RouteMatch;
use Laminas\Session\Container;
use UnicaenApp\Controller\Plugin\Exception\IllegalStateException;
use UnicaenApp\Form\Fieldset\MultipageFormNavFieldset;
use UnicaenApp\Form\MultipageForm;

/**
 * Plugin de contrôleur facilitant la mise en oeuvre d'un formulaire multi-pages.
@@ -24,29 +25,27 @@ class MultipageFormPlugin extends AbstractPlugin
    /**
     * Navigation action constants
     */
    const ACTION_PREFIX   = 'prefix';
    const ACTION_NEXT     = 'next';
    const ACTION_PREVIOUS = 'previous';
    const ACTION_SUBMIT   = 'submit';
    const ACTION_CANCEL   = 'cancel';
    const ACTION_CONFIRM  = 'confirm';
    public const ACTION_PREFIX   = 'prefix';
    public const ACTION_NEXT     = 'next';
    public const ACTION_PREVIOUS = 'previous';
    public const ACTION_SUBMIT   = 'submit';
    public const ACTION_CANCEL   = 'cancel';
    public const ACTION_CONFIRM  = 'confirm';

    const NAV      = MultipageFormNavFieldset::NAME;
    const PREFIX   = MultipageFormNavFieldset::PREFIX_IN_NAME;
    const NEXT     = MultipageFormNavFieldset::NAME_NEXT;
    const PREVIOUS = MultipageFormNavFieldset::NAME_PREVIOUS;
    const SUBMIT   = MultipageFormNavFieldset::NAME_SUBMIT;
    const CANCEL   = MultipageFormNavFieldset::NAME_CANCEL;
    const CONFIRM  = MultipageFormNavFieldset::NAME_CONFIRM;
    public const NAV      = MultipageFormNavFieldset::NAME;
    public const PREFIX   = MultipageFormNavFieldset::PREFIX_IN_NAME;
    public const NEXT     = MultipageFormNavFieldset::NAME_NEXT;
    public const PREVIOUS = MultipageFormNavFieldset::NAME_PREVIOUS;
    public const SUBMIT   = MultipageFormNavFieldset::NAME_SUBMIT;
    public const CANCEL   = MultipageFormNavFieldset::NAME_CANCEL;
    public const CONFIRM  = MultipageFormNavFieldset::NAME_CONFIRM;

    const FIELDSET  = '_fieldset';
    public const FIELDSET  = '_fieldset';

    /**
     * Navigation element names
     *
     * @var array
     */
    protected $navigationElements = [
    protected array $navigationElements = [
        self::ACTION_PREFIX   => self::PREFIX,
        self::ACTION_NEXT     => self::NEXT,
        self::ACTION_PREVIOUS => self::PREVIOUS,
@@ -57,79 +56,52 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Session storage object
     *
     * @var Container
     */
    protected $sessionContainer;
    protected ?Container $sessionContainer = null;

    /**
     * The complete form instance
     *
     * @var MultipageForm
     */
    protected $form;
    protected ?MultipageForm $form = null;

    /**
     * The mapping of fieldset name to controller action
     *
     * @var array
     */
    protected $fieldsetActions = [];
    protected array $fieldsetActions = [];

    /**
     * The order in which the fieldsets appear
     *
     * @var array
     */
    protected $fieldsetOrder = [];
    protected array $fieldsetOrder = [];

    /**
     * The action that will be used for confirming the whole form values
     *
     * @var string
     */
    protected $confirmAction;
    protected ?string $confirmAction = null;

    /**
     * The action that will be used for processing the form
     *
     * @var string
     */
    protected $processAction;
    protected ?string $processAction = null;

    /**
     * The action for canceling the form
     *
     * @var string
     */
    protected $cancelAction;
    protected ?string $cancelAction = null;

    /**
     * Post Redirect Get pattern activation
     *
     * @var bool 
     */
    protected $usePostRedirectGet = false;
    protected bool $usePostRedirectGet = false;

    /**
     * Response
     *
     * @var array|bool|Response
     */
    protected $prgResult;
    protected array|bool|Response $prgResult;

    /**
     * @var bool
     */
    protected $reuseRequestQueryParams = false;
    protected bool $reuseRequestQueryParams = false;

    /**
     * Point d'entrée.
     *
     * @param MultipageForm|null $form Formulaire multi-pages
     * @return self
     */
    public function __invoke(?MultipageForm $form = null)
    public function __invoke(?MultipageForm $form = null): static
    {
        if ($this->sessionContainer === null) {
            $this->sessionContainer = new Container('MultipageForm_' . get_class($this->getController()));
@@ -144,10 +116,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Return response to start process.
     * 
     * @return Response
     */
    public function start()
    public function start(): Response
    {
        if (null === $this->form) {
            throw new IllegalStateException('No form instance set.');
@@ -165,10 +135,9 @@ class MultipageFormPlugin extends AbstractPlugin
    /**
     * Point d'entrée.
     * 
     * @return array|Response
     * @throws IllegalStateException
     */
    public function process()
    public function process(): Response|array
    {
        if (null === $this->form) {
            throw new IllegalStateException('No form instance set.');
@@ -197,14 +166,12 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Handle the form
     *
     * @return array|Response
     */
    protected function handle()
    protected function handle(): Response|array
    {
        // post redirect get pattern if required
        if ($this->usesPostRedirectGet()) {
            $prg = $this->getController()->plugin('prg'); /* @var $prg PostRedirectGet */
            $prg = $this->getController()->plugin('prg'); /* @var PostRedirectGet $prg */
            $result = $prg();
            if ($result instanceof Response) {
                // returned a response to redirect us
@@ -244,10 +211,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Handle the confirmation step
     *
     * @return array|Response
     */
    protected function handleConfirmStep()
    protected function handleConfirmStep(): Response|array
    {
        if (!$this->isValidForm()) {
            // Formulaire complet non valide : redirection vers la dernière étape valide
@@ -273,10 +238,7 @@ class MultipageFormPlugin extends AbstractPlugin
        ];
    }

    /**
     * @return array|Response
     */
    protected function handleSubmittedAction()
    protected function handleSubmittedAction(): Response|array
    {
        $submittedAction = $this->getSubmittedAction();
        $currentFieldset = $this->getCurrentFieldset();
@@ -371,10 +333,8 @@ class MultipageFormPlugin extends AbstractPlugin
    
    /**
     * Cancel multipage form process.
     * 
     * @return Response
     */
    public function cancel()
    public function cancel(): Response
    {
        $this->clearSession();

@@ -391,10 +351,7 @@ class MultipageFormPlugin extends AbstractPlugin
        return $this->redirect($target);
    }

    /**
     * @return string
     */
    protected function getControllerAction()
    protected function getControllerAction(): string
    {
        /** @var MvcEvent $event */
        $event = $this->getController()->getEvent();
@@ -406,11 +363,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Determine if a form has been validated
     *
     * @param string $fieldsetName
     * @return boolean
     */
    protected function isValidFieldset($fieldsetName)
    protected function isValidFieldset(string $fieldsetName): bool
    {
        // Loop through the fieldset => action mapping
        foreach ($this->fieldsetActions as $name => $action) {
@@ -433,10 +387,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Determine if all fieldsets have been validated
     *
     * @return boolean
     */
    protected function isValidForm()
    protected function isValidForm(): bool
    {
        foreach ($this->fieldsetActions as $name => $action) {
            if (!$this->isValidFieldset($name)) {
@@ -449,10 +401,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Retrieve current last valid action
     *
     * @return string
     */
    protected function getLastValidAction()
    protected function getLastValidAction(): string
    {
        $action = null;
        $fieldsetActions = $this->fieldsetActions;
@@ -479,11 +429,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Determine if a fieldset has been submitted and successfully validated
     *
     * @param string $fieldsetName
     * @return mixed
     */
    protected function isCompleteFieldset($fieldsetName)
    protected function isCompleteFieldset(string $fieldsetName): bool
    {
        // Retrieve the validation state from the session
        return
@@ -493,11 +440,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Set the action used for confirming the complete form
     *
     * @param string $action
     * @return self
     */
    public function setConfirmAction($action)
    public function setConfirmAction(string $action): static
    {
        $this->confirmAction = $action;
        return $this;
@@ -505,11 +449,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Set the action used for processing the complete form
     *
     * @param string $action
     * @return self
     */
    public function setProcessAction($action)
    public function setProcessAction(string $action): static
    {
        $this->processAction = $action;
        return $this;
@@ -517,11 +458,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Set a custom cancel action
     *
     * @param string $action
     * @return self
     */
    public function setCancelAction($action)
    public function setCancelAction(string $action): static
    {
        $this->cancelAction = $action;
        return $this;
@@ -531,9 +469,8 @@ class MultipageFormPlugin extends AbstractPlugin
     * Set sequence of actions.
     *
     * @param array $fieldsetActionMapping fieldset name => action name
     * @return self
     */
    protected function setFieldsetActionMapping(array $fieldsetActionMapping = [])
    protected function setFieldsetActionMapping(array $fieldsetActionMapping = []): static
    {
        $fieldsetActions = [];
        $fieldsetOrder   = [];
@@ -556,12 +493,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Set values for an action
     *
     * @param Fieldset $fieldset
     * @param boolean $valid
     * @return self
     */
    protected function setSessionValues(Fieldset $fieldset, $valid = false)
    protected function setSessionValues(Fieldset $fieldset, bool $valid = false): static
    {
        $fieldsetName = $fieldset->getName();
        
@@ -594,21 +527,15 @@ class MultipageFormPlugin extends AbstractPlugin
        return $this;
    }

    /**
     * @param string $submitAction
     */
    private function setSessionSubmitAction($submitAction)
    private function setSessionSubmitAction(string $submitAction): void
    {
        $this->sessionContainer->action = $submitAction;
    }

    /**
     * Retrieve fieldset values from the session
     *
     * @param string $fieldsetName
     * @return mixed
     */
    protected function getSessionValues($fieldsetName)
    protected function getSessionValues(string $fieldsetName): array
    {
        return isset($this->sessionContainer->value[$fieldsetName]) ?
                $this->sessionContainer->value[$fieldsetName] :
@@ -617,11 +544,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Set the form instance
     *
     * @param MultipageForm $form
     * @return self
     */
    public function setForm(MultipageForm $form)
    public function setForm(MultipageForm $form): static
    {
        $this->form = $form;

@@ -630,7 +554,7 @@ class MultipageFormPlugin extends AbstractPlugin
            throw new IllegalStateException('The form needs to have fieldsets.');
        }
        // Loop through all the fieldsets and check if they all have a name
        foreach ($fieldsets as $fieldset) { /* @var $fieldset Fieldset */
        foreach ($fieldsets as $fieldset) { /* @var Fieldset $fieldset */
            if (!($fieldset->getName())) {
                throw new IllegalStateException('A fieldset needs to have a name.');
            }
@@ -653,20 +577,16 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Retourne l'instance du formulaire complet.
     *
     * @return MultipageForm
     */
    public function getForm()
    public function getForm(): ?MultipageForm
    {
        return $this->form;
    }

    /**
     * Retourne le fieldset courant.
     *
     * @return Fieldset
     */
    public function getCurrentFieldset()
    public function getCurrentFieldset(): FieldsetInterface
    {
        $fieldsetName = $this->getSessionActiveFieldsetName();

@@ -675,11 +595,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Get a fieldset by name.
     *
     * @param string $fieldsetName
     * @return Fieldset
     */
    protected function getFieldset($fieldsetName)
    protected function getFieldset(string $fieldsetName): FieldsetInterface
    {
        if (null === $this->form) {
            throw new IllegalStateException('No form instance set.');
@@ -697,10 +614,8 @@ class MultipageFormPlugin extends AbstractPlugin
    /**
     * Get all data from the fieldsets from the session.
     * Including the fieldset's name where we come from.
     *
     * @return array
     */
    public function getFormSessionData()
    public function getFormSessionData(): array
    {
        $formData = [];

@@ -716,10 +631,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Retourne les données POSTées.
     *
     * @return array
     */
    protected function getPostData()
    protected function getPostData(): array
    {
        if ($this->usesPostRedirectGet() && is_array($this->prgResult)) {
            return $this->prgResult;
@@ -736,11 +649,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Retourne les données POSTées concernant le fieldset spécifié.
     *
     * @param Fieldset $fieldset
     * @return array
     */
    protected function getPostDataForFieldset(Fieldset $fieldset)
    protected function getPostDataForFieldset(FieldsetInterface $fieldset): array
    {
        $postData = $this->getPostData();
        if (empty($postData)) {
@@ -776,10 +686,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Retourne les données POSTées concernant le fieldset courant.
     *
     * @return array
     */
    protected function getPostDataForCurrentFieldset()
    protected function getPostDataForCurrentFieldset(): array
    {
        $currentFieldset = $this->getCurrentFieldset();

@@ -789,11 +697,8 @@ class MultipageFormPlugin extends AbstractPlugin
    /**
     * Spécifie que les paramètres GET de la requête courante doivent être conservés
     * lors de la prochaine redirection.
     *
     * @param bool $reuseRequestQueryParams
     * @return $this
     */
    public function setReuseRequestQueryParams($reuseRequestQueryParams = true)
    public function setReuseRequestQueryParams(bool $reuseRequestQueryParams = true): static
    {
        $this->reuseRequestQueryParams = $reuseRequestQueryParams;

@@ -802,11 +707,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Use the redirector plugin to navigate the controller
     *
     * @param string $action
     * @return Response
     */
    protected function redirect($action)
    protected function redirect(string $action): Response
    {
        /** @var MvcEvent $event */
        $event = $this->getController()->getEvent();
@@ -840,10 +742,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Get the action used to submit the form
     *
     * @return string|bool
     */
    protected function getSubmittedAction()
    protected function getSubmittedAction(): bool|string
    {
        $postData = $this->getPostDataForCurrentFieldset();

@@ -864,10 +764,7 @@ class MultipageFormPlugin extends AbstractPlugin
        return false;
    }

    /**
     * @return bool
     */
    protected function isCurrentFieldsetValid()
    protected function isCurrentFieldsetValid(): bool
    {
        $postData = $this->getPostData();

@@ -884,7 +781,7 @@ class MultipageFormPlugin extends AbstractPlugin
     *
     * @return int 1 <= index <= step count
     */
    protected function getCurrentStepIndex()
    protected function getCurrentStepIndex(): int
    {
        $indexes = array_keys($this->fieldsetOrder, $this->getSessionActiveFieldsetName());

@@ -893,10 +790,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Return the number of steps.
     *
     * @return int
     */
    protected function getStepCount()
    protected function getStepCount(): int
    {
        return count($this->fieldsetActions);
    }
@@ -907,39 +802,31 @@ class MultipageFormPlugin extends AbstractPlugin
     * @param string $action Nom de l'action
     * @return string|null le nom du fieldset d'étape s'il existe ; `null` sinon
     */
    protected function getFieldsetNameForAction($action)
    protected function getFieldsetNameForAction($action): ?string
    {
        return array_search($action, $this->fieldsetActions) ?: null;
    }

    /**
     * Check if the action is an action for this form.
     *
     * @param string $fieldsetName
     * @return boolean
     */
    protected function isFieldset($fieldsetName)
    protected function isFieldset(string $fieldsetName): bool
    {
        return array_key_exists($fieldsetName, $this->fieldsetActions);
    }

    /**
     * Get the active fieldset name
     *
     * @return string
     */
    protected function getSessionActiveFieldsetName()
    protected function getSessionActiveFieldsetName(): string
    {
        return $this->sessionContainer->active;
    }

    /**
     * Set the active fieldset name
     *
     * @param string $fieldsetName
     * @return self
     */
    protected function setSessionActiveFieldsetName($fieldsetName)
    protected function setSessionActiveFieldsetName(string $fieldsetName): static
    {
        $this->sessionContainer->active = $fieldsetName;

@@ -948,10 +835,8 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Reset all session data
     *
     * @return self
     */
    public function clearSession()
    public function clearSession(): static
    {
        // Create two brand new arrays
        $valid = [];
@@ -974,21 +859,16 @@ class MultipageFormPlugin extends AbstractPlugin

    /**
     * Returns session persistance container
     * 
     * @return Container
     */
    public function getSessionContainer()
    public function getSessionContainer(): ?Container
    {
        return $this->sessionContainer;
    }

    /**
     * Sets session persistance container
     * 
     * @param Container $container
     * @return self
     */
    public function setSessionContainer(Container $container)
    public function setSessionContainer(Container $container): static
    {
        $this->sessionContainer = $container;

@@ -997,21 +877,16 @@ class MultipageFormPlugin extends AbstractPlugin
    
    /**
     * Return Post-Redirect-Get pattern activation flag
     * 
     * @return bool
     */
    public function usesPostRedirectGet()
    public function usesPostRedirectGet(): bool
    {
        return $this->usePostRedirectGet;
    }
    
    /**
     * Set Post-Redirect-Get pattern activation flag
     * 
     * @param bool $usePostRedirectGet
     * @return self
     */
    public function setUsePostRedirectGet($usePostRedirectGet = true)
    public function setUsePostRedirectGet(bool $usePostRedirectGet = true): static
    {
        $this->usePostRedirectGet = $usePostRedirectGet;

+0 −376

File deleted.

Preview size limit exceeded, changes collapsed.

+24 −104
Original line number Diff line number Diff line
@@ -14,40 +14,22 @@ use Laminas\Form\Fieldset;
 */
class MultipageFormNavFieldset extends Fieldset
{
    const NAME     = '_nav';
    public const NAME     = '_nav';

    const PREFIX_IN_NAME   = '_';
    public const PREFIX_IN_NAME   = '_';

    const NAME_NEXT     = '_next';
    const NAME_PREVIOUS = '_previous';
    const NAME_SUBMIT   = '_submit';
    const NAME_CANCEL   = '_cancel';
    const NAME_CONFIRM  = '_confirm';
    public const NAME_NEXT     = '_next';
    public const NAME_PREVIOUS = '_previous';
    public const NAME_SUBMIT   = '_submit';
    public const NAME_CANCEL   = '_cancel';
    public const NAME_CONFIRM  = '_confirm';

    /**
     * @var boolean
     */
    private $previousEnabled = false;
    /**
     * @var boolean
     */
    private $nextEnabled = true;
    /**
     * @var boolean
     */
    private $submitEnabled = false;
    /**
     * @var boolean
     */
    private $cancelEnabled = true;
    /**
     * @var boolean
     */
    private $confirmEnabled = false;
    private bool $previousEnabled = false;
    private bool $nextEnabled = true;
    private bool $submitEnabled = false;
    private bool $cancelEnabled = true;
    private bool $confirmEnabled = false;

    /**
     * {@inheritDoc}
     */
    private function __construct($name = null, $options = [])
    {
        parent::__construct($name, $options);
@@ -62,19 +44,12 @@ class MultipageFormNavFieldset extends Fieldset
        $this->init();
    }

    /**
     * @param array $options
     * @return self
     */
    static public function create(array $options = []): self
    public static function create(array $options = []): self
    {
        return new static(static::NAME, $options);
    }

    /**
     * @inheritDoc
     */
    public function init()
    public function init(): void
    {
        parent::init();

@@ -85,9 +60,6 @@ class MultipageFormNavFieldset extends Fieldset
        $this->add($this->createConfirmButton());
    }

    /**
     * @return Submit
     */
    protected function createNextButton() : Submit
    {
        $label    = ("Suivant >");
@@ -105,9 +77,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    public function getNextButton() : Submit
    {
        /** @var Submit $submit */
@@ -116,9 +85,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    protected function createPreviousButton() : Submit
    {
        $label    = ("< Précédent");
@@ -136,9 +102,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    public function getPreviousButton() : Submit
    {
        /** @var Submit $submit */
@@ -147,9 +110,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    protected function createCancelButton() : Submit
    {
        $label  = ("Annuler");
@@ -169,9 +129,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    public function getCancelButton() : Submit
    {
        /** @var Submit $submit */
@@ -180,9 +137,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    protected function createSubmitButton() : Submit
    {
        $label  = ("Terminer");
@@ -200,9 +154,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    public function getSubmitButton() : Submit
    {
        /** @var Submit $submit */
@@ -211,9 +162,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    protected function createConfirmButton() : Submit
    {
        $label = ("Confirmer et enregistrer");
@@ -231,9 +179,6 @@ class MultipageFormNavFieldset extends Fieldset
        return $submit;
    }

    /**
     * @return Submit
     */
    public function getConfirmButton() : Submit
    {
        /** @var Submit $submit */
@@ -244,11 +189,8 @@ class MultipageFormNavFieldset extends Fieldset

    /**
     * Active ou non le bouton "Précédent".
     *
     * @param boolean $value
     * @return self
     */
    public function setPreviousEnabled($value = true)
    public function setPreviousEnabled(bool $value = true): static
    {
        $this->previousEnabled = $value;

@@ -257,11 +199,8 @@ class MultipageFormNavFieldset extends Fieldset
    
    /**
     * Active ou non le bouton "Suivant".
     *
     * @param boolean $value
     * @return self
     */
    public function setNextEnabled($value = true)
    public function setNextEnabled(bool $value = true): static
    {
        $this->nextEnabled = $value;

@@ -270,11 +209,8 @@ class MultipageFormNavFieldset extends Fieldset
    
    /**
     * Active ou non le bouton "Terminer".
     *
     * @param boolean $value
     * @return self
     */
    public function setSubmitEnabled($value = true)
    public function setSubmitEnabled(bool $value = true): static
    {
        $this->submitEnabled = $value;

@@ -283,11 +219,8 @@ class MultipageFormNavFieldset extends Fieldset
    
    /**
     * Active ou non le bouton "Annuler".
     *
     * @param boolean $value
     * @return self
     */
    public function setCancelEnabled($value = true)
    public function setCancelEnabled(bool $value = true): static
    {
        $this->cancelEnabled = $value;

@@ -296,11 +229,8 @@ class MultipageFormNavFieldset extends Fieldset
    
    /**
     * Active ou non le bouton "Confirmer et enregistrer".
     *
     * @param boolean $value
     * @return self
     */
    public function setConfirmEnabled($value = true)
    public function setConfirmEnabled(bool $value = true): static
    {
        $this->confirmEnabled = $value;

@@ -309,50 +239,40 @@ class MultipageFormNavFieldset extends Fieldset

    /**
     * Indique si le bouton "Précédent" est autorisé ou non.
     *
     * @return boolean
     */
    public function isPreviousEnabled()
    public function isPreviousEnabled(): bool
    {
        return $this->previousEnabled;
    }

    /**
     * Indique si le bouton "Suivant" est autorisé ou non.
     *
     * @return boolean
     */
    public function isNextEnabled()
    public function isNextEnabled(): bool
    {
        return $this->nextEnabled;
    }

    /**
     * Indique si le bouton "Terminer" est autorisé ou non.
     *
     * @return boolean
     */
    public function isSubmitEnabled()
    public function isSubmitEnabled(): bool
    {
        return $this->submitEnabled;
    }

    /**
     * Indique si le bouton "Annuler" est autorisé ou non.
     *
     * @return boolean
     */
    public function isCancelEnabled()
    public function isCancelEnabled(): bool
    {
        return $this->cancelEnabled;
    }

    /**
     * Indique si le bouton "Confirmer" est autorisé ou non.
     *
     * @return boolean
     */
    public function isConfirmEnabled()
    public function isConfirmEnabled(): bool
    {
        return $this->confirmEnabled;
    }
+49 −111

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -18,6 +18,6 @@ interface MultipageFormFieldsetInterface extends \Laminas\Form\FieldsetInterface
     *
     * @return array 'element_name' => array('label' => Label de l'élément, 'value' => Valeur saisie au format texte)
     */
    public function getLabelsAndValues();
    public function getLabelsAndValues(): array;
    
}
Loading