Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • KevinKevin
    Participant

    I sent you an email GV.
    Kind regards
    K

    in reply to: ℹ️[REQUEST] WYSIWYG tiny in custom_html control #42726
    KevinKevin
    Participant

    Hi Peter,

    Thanks for your reply.
    Sorry to say, but the solution you provide is not really what i need.
    Btw, I understand that there’s currently nothing up that way.
    For my purpose, clients have to set up form
    Fields on their own, that is why I asked for a wysiwyg in custom_html field.
    That would be a very powerful features !

    Again, thanks for your answer,
    I’ll try to do it on my way, and surely keep you updated.

    Have a nice day !
    K

    KevinKevin
    Participant

    Hello Peter,

    Thanks for your answer,

    You should check the link i provided : https://drive.google.com/file/d/1VhqhgDx9Qia2_gJrMlpVmtVgyTdsTe4g/view?usp=drive_link

    it's packed and ready to use :), all you have to do it's include it in functions.php

    A new field type called "include another mb" (include_mb) appears on builder (could be used in pure php as well), and provide a simple way to include a metabox to another metabox by letting you choose wich metabox you would like to include.

    BTW, it will need some improvements, so i let you forward this to the MB team,
    a simple mention if you choose to integrate it would be a nice move 🙂

    Happy to help,

    have a nice day,
    KL

    in reply to: Autocalculation of many numeric fields? #42699
    KevinKevin
    Participant

    Can't :/
    This is my full time job, and i just gave you an hand this time.

    Have a nice day !

    in reply to: Autocalculation of many numeric fields? #42685
    KevinKevin
    Participant

    i just gave you access 🙂

    KevinKevin
    Participant
    KevinKevin
    Participant

    Hi,

    figured it out, here's the function, if anyone need it. :

    function my_custom_callback_metabox( $saved, $field ){
        $added_registry = rwmb_get_registry( 'meta_box' );
        $added_meta_box = $added_registry->get( 'metabox_id' );
    
        $post_id = get_the_ID();
        $added_meta_box->object_id = $post_id;
        $added_meta_box->saved = $saved;
    
        return $added_meta_box->show();
    }

    I will pack it soon in a new field type, and repost it here. could be a great update !

    KevinKevin
    Participant

    hi again,

    i get to something with custom_html field and a callback, but it doesn't save anything at all.

    here's my callback for custom html :

    function my_custom_callback_metabox(){
        $meta_box_registry = rwmb_get_registry( 'meta_box' );
        $meta_box = $meta_box_registry->get( 'the_meta_box_i_callback' );
    
        //render the form
        return $meta_box->show();
    }

    if any of you have a clue,
    thanks again and have a nice day !

    in reply to: Autocalculation of many numeric fields? #42668
    KevinKevin
    Participant

    as i say, it's MB builder compatible eg: you will have a "math Operator" field available on "visual builder".
    simple and easy.
    give it a try

    Have a nice day

    in reply to: Get all field type (Array of all types) #42650
    KevinKevin
    Participant

    Hello Peter,

    i'm aware of that functions, but it only return an array of fields that have been set in a metabox. what i wanted was to have all fields type existing in metabox, like the listing you have in MB Builder.

    BTW, using the mbb_field_types filter, i was able to get what i wanted.

    Many thanks for your help !
    Have a nice day,

    KL

    in reply to: Autocalculation of many numeric fields? #42649
    KevinKevin
    Participant

    NBB : You have to include it via functions.php in your theme

    in reply to: Autocalculation of many numeric fields? #42648
    KevinKevin
    Participant

    Hi GV,

    Here's a custom Fields i've wrote to do so : https://drive.google.com/file/d/1VOTBfJS5LnTdgc2N5hLi6VjUBSZrpmN-/view?usp=sharing

    it supports MB builder and will display a field with the sum of other fields.

    here's a working example :

    
     [
                    'name'     => __( 'Price', 'your-text-domain' ),
                    'id'       => 'id_price',
                    'type'     => 'number',
                    'min'      => 1,
                    'max'      => 10000,
                    'step'     => 1,
                ],
                [
                    'name'     => __( 'Taxes', 'your-text-domain' ),
                    'id'       => 'id_taxes',
                    'type'     => 'number',
                    'min'      => 1,
                    'max'      => 30,
                    'step'     => 1,
                ],
    [
                    'name'     => __( 'Taxes', 'your-text-domain' ),
                    'id'       => 'id_delivery',
                    'type'     => 'number',
                    'min'      => 1,
                    'max'      => 200,
                    'step'     => 1,
                ],
                [
                    'name'      => __( 'Sum Price+Taxes+Delivery', 'your-text-domain' ),
                    'id'        => 'sum_price_taxes_delivery',
                    'type'      => 'math_operator',
                    'id_to_sum' => 'id_price,id_taxes,id_delivery',
                ]
    

    Where you will see a new type of fields called math_operator and where id_to_sum is the id you want calculation for.

    NB : it only support sum for the moment.

    Have a nice day,

    KL

    in reply to: Error while inserting $field_id in rwmb_after_save_post #38017
    KevinKevin
    Participant

    Hi Luong,

    bs_date is one of my creation, it's a custom field based on Bootstrap datepicker, wich is, in my opinion and experience, far better than jqueryUI datepicker.

    Maybe you could have a look on it for a later implementation on MB ?

    Bootstrap DatePicker

    by the way, thanks for all your fantastic works
    have a nice day,
    Kevin

    in reply to: Error while inserting $field_id in rwmb_after_save_post #38016
    KevinKevin
    Participant

    hi ben06,

    you can use the following code for sorting your group by date

    add_action( 'rwmb_pieces_jointes_et_dates_after_save_post', function($object_id){
    
        $pj = $_POST['pieces_jointes_et_dates'];
        //sorting by date with usort 
        usort($pj, function($a, $b) {
            //convert date_fichier DD/MM/YYYY with datetime to get a timestamp that you can sort
            $a_date = DateTime::createFromFormat('d/m/Y', $a['date_fichier']);
            $b_date = DateTime::createFromFormat('d/m/Y', $b['date_fichier']);
            return $a_date->getTimestamp() - $b_date->getTimestamp();
        });
    
        //Then update the whole group value
        update_post_meta($object_id,'pieces_jointes_et_dates', $pj );
    } );

    Have a nice day 🙂

    KevinKevin
    Participant

    Sorry,
    have another idea, on the same files here's the final code :
    file : wp-content/plugins/meta-box-aio/vendor/meta-box/mbb-parser/src/Encoders/MetaBox.php

        private function wrap_function_call() {
    
            $before = apply_filters('rwmb_mbb_before_php_output', '');
            $after = apply_filters('rwmb_mbb_after_php_output', '');
    
            $this->encoded_string = sprintf(
                '<?php
    add_filter( \'rwmb_meta_boxes\', \'%1$s\' );
    
    function %1$s( $meta_boxes ) {
        $prefix = \'%3$s\';
        %4$s
        
        $this_id = \'%6$s\';
        $meta_boxes[$this_id] = %2$s;
        
        %5$s
        return $meta_boxes;
    }',
                $this->function_name,
                $this->encoded_string,
                $this->prefix,
                $before,
                $after,
                $this->settings['id']
            );
            return $this;
        }

    basically, you could extend the php output for get some variables first (before) and modify the $meta_boxes array by calling it with the $this_id index to some more depending on conditions or whatever you like to. very powerful !

    Just a suggestions, as i said, but would be an awesome features for developers.
    Have a nice day, and thanks again,
    Kevin

Viewing 15 posts - 1 through 15 (of 28 total)