0

I'll try to be short: Multilingual Wordpress site with custom post type registered in functions.php and CMB2 for creating custom forms. The plugin for multilingual is q-translate-x and also using CMB2-qTranslate.

My problem is that I'm losing all line breaks and all <p> tags when I switch the language but it only fails if the editor is contained in a repeatable group. If I add the wysiwyg edit as normal field It works fine.

-Relevant code for the normal field (this works fine):

$cmb_tb->add_field( array(
    'name'    => esc_html__( 'Historia', 'cmb2' ),
    'desc'    => esc_html__( 'field description (optional)', 'cmb2' ),
    'id'      => $prefix . 'historia',
    'type'    => 'wysiwyg',
    'options' => array( 'textarea_rows' => 5, 'editor_class' => 'cmb2-qtranslate'),
) );

-Relevant code for repeatable field (this loses line breaks and <p> tags on language switching):

<pre><code>
$group_field_id = $cmb_tb->add_field( array(
'id'          => 'Fincas',
'type'        => 'group',
'description' => __( 'Fincas', 'cmb2' ),
// 'repeatable'  => false, // use false if you want non-repeatable group
'options'     => array(
    'group_title'   => __( 'Finca {#}', 'cmb2' ), // since version 1.1.4, {#} gets replaced by row number
    'add_button'    => __( 'Añadir otra Finca', 'cmb2' ),
    'remove_button' => __( 'Eliminar Finca', 'cmb2' ),
 //   'sortable'      => true, // beta
    'closed'     => false, // true to have the groups closed by default
),
) );

$cmb_tb->add_group_field($group_field_id, array(
    'name'    => esc_html__( 'Nombre Finca', 'cmb2' ),
    'desc'    => esc_html__( '', 'cmb2' ),
    'id'      => $prefix . 'nombre_finca',
    'type'    => 'wysiwyg',
    'options' => array( 'textarea_rows' => 5, 'editor_class' => 'cmb2-qtranslate')
) );

</code></pre>

This is driving me crazy. I've created a sample website with this problem for testing. I can give access to anyone who feels that can help.

Many thanks in advance.

Banzay
  • 9,310
  • 2
  • 27
  • 46
user740155
  • 19
  • 1
  • 3

1 Answers1

0

Finally, I figured out. It was as easy to add 'wpautop' => false to options array

Dharman
  • 30,962
  • 25
  • 85
  • 135
user740155
  • 19
  • 1
  • 3