Forum Replies Created
-
AuthorPosts
-
wefit.lucas
ParticipantYep. I don't want that to change. I think that its the expected behavior, but I think that I should not me able to drop the element outside its parent like I am as of today.
wefit.lucas
ParticipantWorked here as well, thanks.
Anh, I'm having another problem (but it was there before your update). In the same code example, when you create the nested cloneable groups it is possible to sort and drag them anywhere, like for example move a child to same level as its parent or even move a child to a different parent. Once you move it, it'll break the Add clone button and I'm assuming it will mess up with the data in the JSON. Is there a way to avoid that?
Thanks.
wefit.lucas
ParticipantAlright, got it.
Thanks.
wefit.lucas
ParticipantUpdated here, the conditional logic seems to be working now. Thanks Tan.
Still waiting for the group problem. I'm still able to delete all groups in this code example. How can I fix this?
Thanks.
wefit.lucas
ParticipantHi Anh,
Thanks for the response. I'm currently using the conditional-logic v1.3 and metabox group v1.1.4.
wefit.lucas
ParticipantThese options worked, thanks. But I'm still having troubles with the templating. I don't know much PHP, so I'm having trouble to understand how this parameter would work. Taking your code as example:
add_filter( 'rwmb_meta_boxes', 'your_prefix_select_demo' ); function your_prefix_select_demo( $meta_boxes ) { $meta_boxes[] = array( 'title' => __( 'Select Field Demo', 'your-prefix' ), 'fields' => array( array( 'name' => __( 'Select Advanced', 'your-prefix' ), 'id' => 'select_advanced', 'type' => 'select_advanced', 'options' => array( 'value1' => __( 'Label1', 'your-prefix' ), 'value2' => __( 'Label2', 'your-prefix' ), ), 'js_options' => [ 'placeholder' => 'Select whatever you want', 'allowClear' => false, 'templateSelection' => formatState, ], ), ), ); return $meta_boxes; }Being the formatState originally a JS function how am I supposed to use it? Should I pass the function call as a String and have it on a .js file or should I convert it to a PHP function? If I convert it to PHP function, how would I be able to get the 'state' object that is passed on the select2 example?
Sorry for the trouble. thanks.
wefit.lucas
ParticipantActually, I don't think the option js_options is working at all. Just tried adding allowClear and placeholder properties and it is still rendering with the default options (data-options="{"allowClear":true,"width":"none","placeholder":"Select an item"}"). Can you check, please? Tks.
wefit.lucas
ParticipantApparently the problem starts on the second level group:
$meta_boxes[] = array( 'title' => __( 'Content', 'textdomain' ), 'id' => 'myContent', 'post_types' => 'rep_page', 'fields' => array( //---- Select Component Type Metabox ----// array( 'id' => 'content', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( array( 'id' => 'myTitle', 'name' => __( 'Title', 'textdomain' ), 'type' => 'text', 'placeholder' => 'Title', ), array( 'id' => 'myText', 'name' => __( 'Text', 'textdomain' ), 'type' => 'wysiwyg', 'options' => array( 'media_buttons' => false, 'textarea_rows' => 6, 'teeny' => true, ), ), array( 'id' => 'myGroup', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( array( 'id' => 'myText2', 'name' => __( 'Text', 'textdomain' ), 'type' => 'wysiwyg', 'options' => array( 'media_buttons' => false, 'textarea_rows' => 6, 'teeny' => true, ), ), ), ), ), ), ), ); -
AuthorPosts