Do we have javascript html parser that we could use in title_template?
I am using this for builder element title
'title_template' => '{{-title}}{{ if (o.title) { }} : {{-o.title}}{{ } }}',
which result in

I can clean it up with this
o.title.replace(/(<([^>]+)>)/ig,"")

but I rather display it as html.
Is it possible ?
{{ console.log("Hello"); }}- Execute any javascript code{{- some.variable }}- Print a variable html escaped{{= some.variable }}- Print a variable (no html escape)
Bless you !

Darn thing , was hoping to soon , see this , cant nail drag and drop inside column if html is present
http://screencast.com/t/ffnNXQaVYf
seems like it looks for specific height
https://github.com/ThemeFuse/Unyson-PageBuilder-Extension/issues/25#issuecomment-124544398
+1000
@moldcraft sorry for all new things , just picking up where I left off.
no problem.
P.S. Next issue that I will do is this then this. Other issues may be inactive until I will finish those 2. If you have a free developer in your team, he can pick any issue and try to debug and resolve it, we accept pull requests :)
thnx bud , will forward to team and help around. I know how messy all those issues can get. Thnx for all the help.
sorry but I need small help on this title thing ,
this , gets me the select option value for revolution slider
{= o.revslider}
http://prntscr.com/7xcx6l
but I am after the title not the value
http://prntscr.com/7xcxib
the o = object does not return anything else , this is console log for it
Object {revslider: "kenburns_fullwidth"}
I tried also with fw.opg but no luck, is there any way to do this ?
At the moment, no.
@danyj did you try with Text block and Image shortcode? The code below seem didn't work with that shortcodes
'title_template' => '{{-title}}{{ if (o.title) { }} : {{-o.title}}{{ } }}',
Until the possibility will be added, you can localize script an array with all choices from revslider option array('choice_id' => 'Choice Title')
{{= _localized_revslider_choices[ o.revslider ] }}
@duongancol , yes above, https://github.com/ThemeFuse/Unyson/issues/759#issuecomment-124717955
those work fine no issues , what I am talking about now is the select option not textarea or text ,
example
'choice-1' => __('Choice 1', 'fw'),
'choice-2' => array(
'text' => __('Choice 2', 'fw'),
'attr' => array('data-foo' => 'bar'),
),
this will than return choice-1 instead the title Choice 1
@moldcraft I see what you mean. Will try that until the feature is added.
@duongancol the confusion u might have is the o.title , I used that as option name
use this for text-block
'title_template' => '{{-title}}{{ if (o.text) { }} : {{-o.text}}{{ } }}',
and this for image
'title_template' => '{{-title}}{{ if (o.image) { }} : {{-o.image}}{{ } }}',
u might want to tweak image and add img tag around it if u want it displayed
in short ,
o.some_option_name
is this for example
http://prntscr.com/7xirrx
@danyj when I add
'title_template' => '{{-title}}{{ if (o.image) { }} : {{-o.image}}{{ } }}',
to Image shortcode It showed like that : http://prntscr.com/7y8mgh
@duongancol this is console log for o.image http://prntscr.com/7zx7ci
so you would need
o.image.url
or
'title_template' => '{{-title}}{{ if (o.image) { }} : <img style=\'width:100px;height:auto;\' src=\'{{-o.image.url }}\' /> {{ } }}',
http://prntscr.com/7zxaeb
Thank @danyj
@moldcraft those notations are very space sensitive , you said
{{ console.log("Hello"); }} - Execute any javascript code
but that is not true , we must do those
{{ } , }}}
all the time , and if we space the code we get template error
example I expect this to work
'template' => '{{
var bgtype = background.bg_type;
var hasimg = background.image;
if (hasimg && bgtype == \'image\') {
\'<img style="width:80px;height:auto;" src=\'hasimg\'/>\';
} else {
title
}
}}'
but it does not , than I do this
'template' => '{{
var bgtype = background.bg_type;
var hasimg = background.image;
if (hasimg && bgtype == \'image\') { }}
\'<img style="width:80px;height:auto;" src=\'{{-hasimg}}\'/>\';
{{ } else { }}
{{=title}}
{{ }
{{ } }}'
again error ,
until I do
'template' => '{{var bgtype = background.bg_type;var hasimg = background.image;if (hasimg && bgtype == \'image\') { }}
\'<img style="width:80px;height:auto;" src=\'{{-hasimg}}\'/>\';
{{ } else { }}
{{=title}}
{{ }
{{ } }}'
I think it's related to new lines, not to spaces.
Something similar https://github.com/jashkenas/underscore/issues/35
Better do
'template' => '{{ '
.'var bgtype = background.bg_type; '
.'var hasimg = background.image; '
...