system/src/Grav/Framework/Form/Traits/FormTrait.php
/**
     * Parse PSR-7 ServerRequest into data and files.
     *
     * @param ServerRequestInterface $request
     * @return array
     */
Parse PSR-7 ServerRequest into data and files.
@param ServerRequestInterface $request
@return array
Parse PSR - 7 ServerRequest into data and files . @param ServerRequestInterface $request @return array
protected function parseRequest(ServerRequestInterface $request): array
    {
        $method = $request->getMethod();
        if (!\in_array($method, ['PUT', 'POST', 'PATCH'])) {
            throw new \RuntimeException(sprintf('FlexForm: Bad HTTP method %s', $method));
        }
        $body = $request->getParsedBody();
        $data = isset($body['data']) ? $this->decodeData($body['data']) : null;
        $flash = $this->getFlash();
        $blueprint = $this->getBlueprint();
        $includeOriginal = (bool)($blueprint->form()['images']['original'] ?? null);
        $files = $flash->getFilesByFields($includeOriginal);
        $data = $blueprint->processForm($data ?? [], $body['toggleable_data'] ?? []);
        return [
            $data,
            $files ?? []
        ];
    }
protected function parseRequest ( ServerRequestInterface $ request ) : array { $ method = $ request -> getMethod ( ) ; if ( ! \ in_array ( $ method , [ 'PUT' , 'POST' , 'PATCH' ] ) ) { throw new \ RuntimeException ( sprintf ( 'FlexForm: Bad HTTP method %s' , $ method ) ) ; } $ body = $ request -> getParsedBody ( ) ; $ data = isset ( $ body [ 'data' ] ) ? $ this -> decodeData ( $ body [ 'data' ] ) : null ; $ flash = $ this -> getFlash ( ) ; $ blueprint = $ this -> getBlueprint ( ) ; $ includeOriginal = ( bool ) ( $ blueprint -> form ( ) [ 'images' ] [ 'original' ] ?? null ) ; $ files = $ flash -> getFilesByFields ( $ includeOriginal ) ; $ data = $ blueprint -> processForm ( $ data ?? [ ] , $ body [ 'toggleable_data' ] ?? [ ] ) ; return [ $ data , $ files ?? [ ] ] ; }
Parse PSR-7 ServerRequest into data and files.
Parse PSR - 7 ServerRequest into data and files .
/*
        if (null !== $data) {
            $flash->setData($data);
            $flash->save();
        }
        */