Custom Type Raw (7 posts)

  1. Cory Lamle
    Posted 2 years ago #

    I just updated to types 1.2 and the types raw seems to not work anymore. It actually calls the WPCF_Field->html function every-time even though I pass the data as such:

    types_render_field("my-field", array("raw" => "true"))

    The html functions calls do_shortcut which cause issues if your trying to get the data raw...

    Has anyone else seen this issue? Is this new desired behavior? How can I get the data truly raw without having do_shortcut process the results?



  2. Cory Lamle
    Posted 2 years ago #

    So my custom fix to get this back working the way it did pre version 1.2 was to add the following lines to frontend.php at the bottom of the
    types_render_field method:

    // API filter
    $wpcf->field->set( $post, $field );
    if ( isset( $params['raw'] ) && $params['raw'] == 'true' ) {
    	return $html;
    } else {
    	return $wpcf->field->html( $html );
  3. Cory Lamle
    Posted 2 years ago #

    Here is another fix if your trying to store numeric values of zero. Before 1.2 I was able to store numeric types of "0". Since the upgrade this is not possible since the empty function will by-pass "0".



    if ( !empty( $value ) ) {
    if ( !empty( $value ) || is_numeric($value))

    Hope this helps others!

  4. Srdjan
    Plugin Author

    Posted 2 years ago #

    You're right, some part of code is reviewed and not working same as before.

    1. We enabled do_shortcode support when 'raw' is TRUE. Do you think it should be enabled only for WYSIWYG ield type in RAW mode?

    2. Do you suggest to allow writing 0 value for Numeric field?

  5. Cory Lamle
    Posted 2 years ago #

    Hi Srdjan,

    Thanks for getting back...

    1. I think raw should really mean raw it should have no other processing added to it. By pre-processing it with other filters and functions it really isn't raw. When I think of raw from the DB I should get back pretty much what I would get from a SELECT statement and nothing else...

    2. Zero by definition is a "Whole Number" so it should be included in any numeric definition.

    I think by bringing back the pre 1.2 changes the definitions of your API will be much more accurate, right now they will lead to further help-desk tickets in the future. I also know with every update that is released that I will have to go back and update these files as this is how I have already built out a rather large site using Types...


  6. Srdjan
    Plugin Author

    Posted 2 years ago #

    Fixes are added for next release for both issues.

  7. Cory Lamle
    Posted 2 years ago #

    Awesome! Looking forward to it...

    Thanks Srdjan!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic