Hi Yanick,
Thank you for your question.
We will check then inform you soon.
Best regards,
Anthony
Hi!
First of all, this field is special because its data format.
This field required container shortcode such as [name]content[/content]
so make sure that you added the config:
is_contaner => true
Please read careful our document http://docs.kingcomposer.com/available-param-types/textarea-html-field/
Hi, thanks for your quick response.
<?php if (!defined('ABSPATH')) die('Forbidden');
global $kc;
$kc->add_map(
array(
'cs_text' => array(
'name' => __('Text', 'cs'),
'description' => __('Add a simpel textarea', 'cs'),
'icon' => 'fa-align-left',
'category' => 'Content',
'is_container' => true,
'params' => array(
array(
'name' => 'content',
'type' => 'textarea_html',
)
)
)
)
);
add_shortcode('cs_text', 'cs_text');
function cs_text($atts) {
return $atts['content'];
}
Somehow it still doesn’t work, when I enter text and click on “Save” in the popup and “Update” afterwards, the text isn’t saved. If I use another element with just a textfield parameter it works.
Am I really dumb or is it a bug?
Oops, it says resolved but still it isn’t fixed? If I use the example from your documents it doesn’t work either.
Hi Yanick!
Please wait, I am checking and get back to you in 30 minutes.
I’ve updated the plugin to version 2.2.1
Now you can use the field “editor” instead
global $kc;
$kc->add_map(
array(
'cs_text' => array(
'name' => __('Text', 'cs'),
'description' => __('Add a simpel textarea', 'cs'),
'icon' => 'fa-align-left',
'category' => 'Content',
'is_container' => true,
'params' => array(
array(
'name' => 'content1', // now you can set arbitrary name
'type' => 'editor', // use 'editor' type instead
'admin_label' => true, // show preview on builder
),
array(
'name' => 'content2',
// able to use multiple editor on one element
'type' => 'editor',
'admin_label' => true,
)
)
)
)
);
add_shortcode('cs_text', 'cs_text');
function cs_text($atts) {
$content1 = base64_decode( $atts['content1'] );
// To keep safety content format, we must encode by base64.
// So you just decode before use
return $content1;
}
Super, works! Thanks!
Only if you want to use the param name content it doesn’t work. Just so you know and maybe you can fix it.
The name content is special kind, it returns shortcode content instead attributes.
Example [kc content=”text 1″] text inner [/kc]
It returns “text inner” not “text 1”