public function submitSuggestedValues(Request $request, $bas_id)
    {
        $success = false;

        $collection = \collection::getByBaseId($this->app, $bas_id);
        $prefs = $request->request->get('str');

        try {
            if ('' !== trim($prefs)) {
                $domdoc = new \DOMDocument();
                if (true === @$domdoc->loadXML($prefs)) {
                    $collection->set_prefs($domdoc);
                    $success = true;
                }
            }
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'bas_id'  => $collection->get_base_id(),
            ]);
        }

        return $this->app->redirectPath('admin_collection_display_suggested_values', [
            'bas_id'      => $collection->get_sbas_id(),
            'success'     => (int) $success,
        ]);
    }
public function submitSuggestedValues(Request $request, $bas_id)
    {
        $success = false;

        $collection = \collection::getByBaseId($this->app, $bas_id);
        $prefs = $request->request->get('str');

        try {
            if ('' !== trim($prefs)) {
                $domdoc = new \DOMDocument();
                if (true === @$domdoc->loadXML($prefs)) {
                    $collection->set_prefs($domdoc);
                    $success = true;
                }
            }
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'bas_id'  => $collection->get_base_id(),
            ]);
        }

        return $this->app->redirectPath('admin_collection_display_suggested_values', [
            'bas_id'      => $collection->get_sbas_id(),
            'success'     => (int) $success,
        ]);
    }
public function submitSuggestedValues ( Request $ request , $ bas_id ) { $ success = false ; $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; $ prefs = $ request -> request -> get ( 'str' ) ; try { if ( '' !== trim ( $ prefs ) ) { $ domdoc = new \ DOMDocument ( ) ; if ( true === @ $ domdoc -> loadXML ( $ prefs ) ) { $ collection -> set_prefs ( $ domdoc ) ; $ success = true ; } } } catch ( \ Exception $ e ) { } if ( 'json' === $ request -> getRequestFormat ( ) ) { return $ this -> app -> json ( [ 'success' => $ success , 'msg' => $ success ? $ this -> app -> trans ( 'Successful update' ) : $ this -> app -> trans ( 'An error occured' ) , 'bas_id' => $ collection -> get_base_id ( ) , ] ) ; } return $ this -> app -> redirectPath ( 'admin_collection_display_suggested_values' , [ 'bas_id' => $ collection -> get_sbas_id ( ) , 'success' => ( int ) $ success , ] ) ; }
Register suggested values

@param  Request $request The current request
@param  integer $bas_id  The collection base_id
@return Response
Register suggested values