Closed dimbak closed 6 years ago
I'm not sure if it's the documentation that needs to be updated or the code, but it's easy enough to send the function an array like it's expecting, and it does work after making that change.
i.e. echo Caldera_Forms_Entry_Viewer::form_entry_viewer_2( array('CF5b1fd03e3a2d2') );
This is an error in the docs. It should be the form config array, so:
$form = Caldera_Forms_Forms::get_form( 'CF5b1fd03e3a2d2' );
if( is_array( $form ) ){
echo Caldera_Forms_Entry_Viewer::form_entry_viewer_2( $form );
}
Example code in docs is now updated with correct syntax and a better inline explanation: https://gist.github.com/Shelob9/0c8fa854aa53fc1d12b49bfd5a5ce6f6#file-caldera-forms-entry-viewer-php
What Version Of Caldera Forms, WordPress and PHP Are You Using?
WordPress Version: 4.9.6PHP Version: 7.0.30MySQL Version: 10.1.33Caldera Forms Version: 1.7.1.4WP_DEBUG: 1
Does Your Issue Persist When You Disable All Other Plugins and Switch To The Default Theme?
yes
What Is The Unexpected Behaviour?
From the documentation : https://calderaforms.com/doc/caldera-forms-wordpress-form-entry-viewer/
I tried to use echo Caldera_Forms_Entry_Viewer::form_entry_viewer_1( 'CF5b1fd03e3a2d2' ); or echo Caldera_Forms_Entry_Viewer::form_entry_viewer_2( 'CF5b1fd03e3a2d2' );
and i got this error
Fatal error: Uncaught TypeError: Argument 1 passed to Caldera_Forms_Entry_Viewer::form_entry_viewer_2() must be of the type array, string given, called in /home/test/public_html/caldera/wp-content/themes/twentyseventeen/functions.php on line 592 and defined in /home/test/public_html/caldera/wp-content/plugins/caldera-forms/classes/entry/viewer.php:134 Stack trace: #0 /home/test/public_html/caldera/wp-content/themes/twentyseventeen/functions.php(592): Caldera_Forms_Entry_Viewer::form_entry_viewer_2('CF5b1fd03e3a2d2') #1 /home/test/public_html/caldera/wp-includes/class-wp-hook.php(286): {closure}('') #2 /home/test/public_html/caldera/wp-includes/plugin.php(203): WP_Hook->apply_filters('', Array) #3 /home/test/public_html/caldera/wp-includes/post-template.php(240): apply_filters('the_content', '') #4 /home/test/public_html/caldera/wp-content/themes/twentyseventeen/template-parts/page/content-page.php(22): the_content() #5 /home/test/public_html/caldera/wp-includes/template.php(690): require('/ in /home/test/public_html/caldera/wp-content/plugins/caldera-forms/classes/entry/viewer.php on line 134