GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
field-signature-html.php
Go to the documentation of this file.
1 <?php
2 /**
3  * The default signature field output template.
4  *
5  * @global \GV\Template_Context $gravityview
6  * @since 2.0
7  */
8 
9 if ( ! isset( $gravityview ) || empty( $gravityview->template ) ) {
10  gravityview()->log->error( '{file} template loaded without context', array( 'file' => __FILE__ ) );
11  return;
12 }
13 
14 $field = $gravityview->field->field;
15 $value = $gravityview->value;
16 
17 // If empty, there's no signature to show
18 if ( empty( $value ) ) { return; }
19 
20 if ( ! class_exists( 'GFSignature' ) ) {
21  gravityview()->log->error( '[fields/signature.php] GFSignature not loaded.' );
22  return;
23 }
24 
25 $image_atts = array(
26  'src' => GFSignature::get_instance()->get_signature_url( $value ),
27  'width' => \GV\Utils::_GET( 'boxWidth', \GV\Utils::get( $field, 'boxWidth', 300 ) ), // Taken from signature addon signature_input() method
28  'height' => '180', // Always 180
29  'validate_src' => false, // Don't check if there's a valid image extension
30  'alt' => '',
31 );
32 
33 echo new GravityView_Image( $image_atts );
Generic class for generating image tag.
if(empty( $value)) if(! class_exists( 'GFSignature')) $image_atts
if(! isset( $gravityview)||empty( $gravityview->template)) $field
The default signature field output template.
gravityview()
The main GravityView wrapper function.