• Resolved dkurth

    (@dkurth)


    I discovered this page
    Do you have any sample code that shows the operations of function calls from this page:
    https://cmb2.io/api/class-CMB2_Field.html

    It appears to have the ability to get values from the CMB2 system. The one in specific is

    value( string $key = '' )

    When doing a dump of the show_on_cb callback and the resulting parameter is a
    CMB2_Field Object

    Should these not work to retrieve data? I am back to the front end, and need to retrieve the data within a record, but before display. Specifically the postid, which is stored there.

    13-07-2019, 22:54:05: CMB2_Field Object
    (
        [properties_name:protected] => args
        [args] => Array
            (
                [type] => select
                [name] => Horse Breed: 
                [desc] => 
                [before] => 
    

    if this does and you can show me a sample of code, this would solve the problem. presently the call is coming up blank.

    • This topic was modified 5 years, 8 months ago by dkurth.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Woo, object orientated programming. Assuming you’re accepting the CMB2_Field parameter in your callbacks, you should be able to use any of the public functions documented there, from the variable you assign it to.

    function something( $some_value, $something, $thecmb2_field ) {
        $thing = $thecmb2_field->get('something');
    }
    

    I can’t make any promises on exactly what all will be available to you, especially off the top of my head, but it’s at least worth tinkering around with. I realize you mention sample code, but I don’t have any immediate ones i know of, outside of CMB2 core that would be using these fields themselves.

    Thread Starter dkurth

    (@dkurth)

    GOT IT.

    • This reply was modified 5 years, 8 months ago by dkurth.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CMB2 SDK QUESTION’ is closed to new replies.