Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Rahul Pranami

    (@rahulpranami)

    Yes, It is viewScript and i am currently doing something like below in render.php but it is not ideal for large amount of attributes.

    <div <?php echo get_block_wrapper_attributes(); ?> data-attributes='<?php echo json_encode($attributes); ?>'></div>

    as for another approach there is something like below but it would not work properly for multiple blocks

    <script type="application/json" id="block-attributes-json">
        <?php echo json_encode($attributes); ?>
    </script>

    I want some solution like i can pass some id and then fetch attributes using that id but using clientId is not ideal as whenever i load the edit screen clientId is going to be changed everytime.

    Yes, These categories are compatible with GFAPI::get_forms();

    You can access those categories like this

    
    $form = GFAPI::get_form( 3 );
    $form['gravityforms-categories']['gforms_categories'];
    

    response would be an array of categories with bool true if they are assigned otherwise false like below

    Array ( [7] => 0 [4] => 0 [5] => 1 [31] => 0 [32] => 0)

Viewing 2 replies - 1 through 2 (of 2 total)