TheFootballSocialClub / FSCHateoasBundle

Please use https://github.com/willdurand/hateoas and https://github.com/willdurand/BazingaHateoasBundle instead.
94 stars 26 forks source link

Form value should be in CDATA section #48

Closed lyrixx closed 11 years ago

lyrixx commented 11 years ago

XmlFormViewSerializer Do not serialize value with CDATA section. Which can create some issues is the value contains some xml tag.

What I did:

    /*
        <textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
    */
    protected function serializeTextareaWidget(\DOMElement $parentElement, FormView $view, $variables)
    {
        $textareaElement = $parentElement->ownerDocument->createElement('textarea');
        $textareaElement->appendChild($parentElement->ownerDocument->createCDATASection($variables['value']));
        $parentElement->appendChild($textareaElement);

        $this->addWidgetAttributes($textareaElement, $view, $variables);
    }

Do you want a PR ? Should i CDATAize all the field ?

lyrixx commented 11 years ago

Oups, I say some bullshit. This is relevant only for textarea... So I can convert this issue to a PR with my small patch.

adrienbrault commented 11 years ago

Hey, a PR would be welcomed :)

On Tuesday, April 30, 2013, Grégoire Pineau wrote:

Oups, I say some bullshit. This is relevant only for textarea... So I can convert this issue to a PR with my small patch.

— Reply to this email directly or view it on GitHubhttps://github.com/TheFootballSocialClub/FSCHateoasBundle/issues/48#issuecomment-17216177 .

adrienbrault commented 11 years ago

Fixed with https://github.com/adrienbrault/form-serializer/pull/1