public function parseBlocks($payload, $module)
    {
        $blockCollection = [];

        foreach ($payload as $key => $value) {
            if (stristr($key, 'block_')) {
                $blockName = str_replace('block_', '', $key);
                $blockCollection[$blockName] = $value;
                unset($payload[$key]);
            }
        }

        $blockCollection = $this->parseTemplate($payload, $blockCollection, $module);

        if (empty($blockCollection)) {
            $payload['blocks'] = "{}";
        } else {
            $payload['blocks'] = json_encode($blockCollection);
        }

        return $payload;
    }
public function parseBlocks($payload, $module)
    {
        $blockCollection = [];

        foreach ($payload as $key => $value) {
            if (stristr($key, 'block_')) {
                $blockName = str_replace('block_', '', $key);
                $blockCollection[$blockName] = $value;
                unset($payload[$key]);
            }
        }

        $blockCollection = $this->parseTemplate($payload, $blockCollection, $module);

        if (empty($blockCollection)) {
            $payload['blocks'] = "{}";
        } else {
            $payload['blocks'] = json_encode($blockCollection);
        }

        return $payload;
    }
public function parseBlocks ( $ payload , $ module ) { $ blockCollection = [ ] ; foreach ( $ payload as $ key => $ value ) { if ( stristr ( $ key , 'block_' ) ) { $ blockName = str_replace ( 'block_' , '' , $ key ) ; $ blockCollection [ $ blockName ] = $ value ; unset ( $ payload [ $ key ] ) ; } } $ blockCollection = $ this -> parseTemplate ( $ payload , $ blockCollection , $ module ) ; if ( empty ( $ blockCollection ) ) { $ payload [ 'blocks' ] = "{}" ; } else { $ payload [ 'blocks' ] = json_encode ( $ blockCollection ) ; } return $ payload ; }
Convert block payloads into json

@param  array $payload
@param  string $module

@return array
Convert block payloads into json