in case of moving them to wrong place
or you can make a validator for that one that will be checking if it's in the right parent class
We have a client that want to embed <script> code in the CMS for his social media curator accounts which is fine but I cant get it to render as HTML , it just shows the code rather than rendering. Anyone got any ideas please?
are you trying to add it in tinymce?
Sorry I am not to sure what that is, I have tried the HTMLText field using embed source?
Sorry tinymce is WYSIWYG in that case yes I am
right, can you post your code?
hang on - you're trying to embed a script tag in tinymce or is a separate field?
- /* curator-feed */
- var i, e, d = document, s = "script";i = d.createElement("script");i.async = 1;
- i.src = "https://cdn.curator.io/published/b54c3375-7ee1-41e3-8522-d3c1b6cf935a.js";
- e = d.getElementsByTagName(s);e.parentNode.insertBefore(i, e);
and you're pasting that directly into the wysiwyg editor, or are you inserting it via the "source code" view of the editor?
He wants to add the above through the CMS but I cant get it render it just shows as you read it above
ok - pasting directly into the editor would convert everything to escaped HTML because it's meant to be a text entry form
you'd need to open the source code view and paste it there
BUT tinymce would remove script tags by default, so you'll need to allow them
I am running tinyMCE on my site and I'm trying to insert script tags. I am trying to insert my script tags into the body of the source of the tinyMCE instance. However, when I do I get problems. ...Hide attachment content
Yeah soon as I save it inside source code view it clears it
that link should help me then , thank you
here's an example for how to enable it in SS: https://github.com/silverstripe/silverstripe-admin/blob/1/_config.php#L34
- 'extended_valid_elements' => 'script[language|type|src]'
obligatory note: it's unsafe to do this
Thank you - Do I use that code in _config.php or the class im trying to embed the script?
you'd be better to add a
CuratorURL textfield to your page, allow them to put
https://cdn.curator.io/published/b54c3375-7ee1-41e3-8522-d3c1b6cf935a.js into it, then render the rest of the script tag in a template and insert the URL
you'd put that code in
Yeah I also tried that but it breaks curator for some reason
I'll give both a go, thank you for your help 🙂
FYI we do something similar to this with an A/B tester tool on http://silverstripe.org, TextField in the CMS for the URL and insert the rest of the script tag in a template if it's set. also common with google analytics tracking code - enter your code and then render the rest of the snippet in a template if it's set
Okay thank you I will check that out 🙂
+1 you really want this to go in the template and add plain text variables through the CMS
are you trying to add it in tinymce?
How should I migrate elemental elements from elemental 1.x to 3.x (SS 3.x vs. 4.x)?
Probable it needs some remapping but is there a migration Task to reflect that
BaseElement now extends now DO instead of
- ElementalArea: DNADesign\Elemental\Models\ElementalArea
- BaseElement: DNADesign\Elemental\Models\BaseElement
have you tried something and had problems? I would've thought that dev/build with the legacy classname remapping config would've done most of the work for you
migration runs trough but elements are all gone or not associated how they should.
I thought they are missing because of
Pleas correct me if I'm wrong but AFAICT it's not possible to migrate elements with just the remaping-task.
BaseElement have to be merged into
BaseElement. Since there is no Widget in SS 4 I think I need to recreate the
Widget-Model to get a Migration-Task running. Is this correct or am I on the wrong path?
Yeah, it would definitely need some logic, eg. a task for migration. I suspect that this doesn't exist, since this issue is still open: https://github.com/dnadesign/silverstripe-elemental/issues/97