• Hello!

    I was trying to prepopulate a select field and give up on my try when I discovered (on the source code) that I can add my own custom types (y). Later on, when I was trying to add my custom field type, I found that it could be possible to prepopulate select fields (and maybe another field types) if the following line change a little bit:

    od-functions-option-types.php on Line 36 (version 2.0.16)

    /* allow filters to be executed on the array */
    apply_filters( ‘ot_display_by_type’, $args );

    This line tries to give us the ability to do our stuff on $args, but as the returned value of the filter is not assigned to $args, and $args is not passed by reference, any change we do on $args while filtering won’t be “saved” after the filter ends.

    Here are two possible improvements for this:

    /* allow filters to be executed on the array */
    $args = apply_filters( ‘ot_display_by_type’, $args );

    /* allow filters to be executed on the array */
    apply_filters( ‘ot_display_by_type’, &$args );

    I hope you can implement this on the next release 🙂

    http://wordpress.org/extend/plugins/option-tree/

The topic ‘Small improve to ot_display_by_type()’ is closed to new replies.