Giter VIP home page Giter VIP logo

Comments (2)

michael-e avatar michael-e commented on September 16, 2024

I found the problem, but I do not see any solution at the moment.

The custom field I mentioned contains XML data in a textarea. The DOMDocument::loadHTML() method used by the Static Section extension does not like the tag <recipient-groups>, which is the root element of my XML.

Any ideas how to solve this? This what the output of my custom field looks like:

<label>Recipient Groups
    <textarea name="fields[8][rec_groups]" rows="10" cols="50" class="code"><recipient-groups><group id="1" page-id="8" entry-node="entry" name-node="name" email-node="email">Clients</group><group id="2" page-id="13" entry-node="partner" name-node="full-name" email-node="email">Partners</group></recipient-groups></textarea>
</label>

(Hey, this looks really bad, doesn't it? -- I am afraid that this is not valid HTML. So it's my fault...)

from static_section.

michael-e avatar michael-e commented on September 16, 2024

I think I found the solution. I can apply General::sanitize() to my XML string when building the field data for the section editor, like so:

$label->appendChild(Widget::Textarea('fields['.$this->get('sortorder').'][rec_groups]', 10, 50, General::sanitize($this->get('rec_groups')), array('class' => 'code')));

This way I get the following HTML:

<label>Recipient Groups
    <textarea name="fields[8][rec_groups]" rows="10" cols="50" class="code">&lt;recipient-groups&gt;
        &lt;group id="1" page-id="7" entry-node="entry" name-node="name" email-node="email"&gt;Clients&lt;/group&gt;
        &lt;group id="2" page-id="11" entry-node="partner" name-node="full-name" email-node="email"&gt;Partners&lt;/group&gt;
    &lt;/recipient-groups&gt;</textarea></label> 

The XML is nevertheless saved correctly to the database.

So: Problem solved!

from static_section.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.