public function getFlash(): FormFlash
    {
        if (null === $this->flash) {
            /** @var Grav $grav */
            $grav = Grav::instance();
            $id = null;

            $user = $grav['user'] ?? null;
            if (isset($user)) {
                $rememberState = $this->getBlueprint()->get('form/remember_state');
                if ($rememberState === 'user') {
                    $id = $user->username;
                }
            }

            // Session Required for flash form
            $session = $grav['session'] ?? null;
            if (isset($session)) {
                // By default store flash by the session id.
                if (null === $id) {
                    $id = $session->getId();
                }


                $this->flash = new FormFlash($id, $this->getUniqueId(), $this->getName());
                $this->flash->setUrl($grav['uri']->url)->setUser($user);
            }
        }

        return $this->flash;
    }
public function getFlash(): FormFlash
    {
        if (null === $this->flash) {
            /** @var Grav $grav */
            $grav = Grav::instance();
            $id = null;

            $user = $grav['user'] ?? null;
            if (isset($user)) {
                $rememberState = $this->getBlueprint()->get('form/remember_state');
                if ($rememberState === 'user') {
                    $id = $user->username;
                }
            }

            // Session Required for flash form
            $session = $grav['session'] ?? null;
            if (isset($session)) {
                // By default store flash by the session id.
                if (null === $id) {
                    $id = $session->getId();
                }


                $this->flash = new FormFlash($id, $this->getUniqueId(), $this->getName());
                $this->flash->setUrl($grav['uri']->url)->setUser($user);
            }
        }

        return $this->flash;
    }
public function getFlash ( ) : FormFlash { if ( null === $ this -> flash ) { /** @var Grav $grav */ $ grav = Grav :: instance ( ) ; $ id = null ; $ user = $ grav [ 'user' ] ?? null ; if ( isset ( $ user ) ) { $ rememberState = $ this -> getBlueprint ( ) -> get ( 'form/remember_state' ) ; if ( $ rememberState === 'user' ) { $ id = $ user -> username ; } } // Session Required for flash form $ session = $ grav [ 'session' ] ?? null ; if ( isset ( $ session ) ) { // By default store flash by the session id. if ( null === $ id ) { $ id = $ session -> getId ( ) ; } $ this -> flash = new FormFlash ( $ id , $ this -> getUniqueId ( ) , $ this -> getName ( ) ) ; $ this -> flash -> setUrl ( $ grav [ 'uri' ] -> url ) -> setUser ( $ user ) ; } } return $ this -> flash ; }
Get form flash object.

@return FormFlash
Get form flash object .