Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author tameroski

    (@tameroski)

    Technically it could be possible, as you can draw whatever you want on a canvas, but it seams very complicated to draw the name dynamically.

    The line is something more reachable, using javascript.

    But that’s not something i would consider as a future feature, sorry.

    Thread Starter bambicruz

    (@bambicruz)

    Thanks, so as far as the line / static text. Where can I put it? I tried to insert the following in the “signature.php” file, but I only see the text for the second it takes to load the page, after that it just disappears:

    $html = sprintf(
    		'<div class="wpcf7-form-control-signature-global-wrap" data-field-id="%1$s">
    			<div class="wpcf7-form-control-signature-wrap" style="width:%5$spx;height:%6$spx;">
    				<div class="wpcf7-form-control-signature-body">
    					<canvas id="%8$s" class="%9$s"><script type="text/javascript">
    var canvas = document.getElementById("%8$s");
    var ctx = canvas.getContext("2d");
    ctx.font = "30px Arial";
    ctx.fillText("Hello World",10,50);
    </script></canvas>
    
    <input id="wpcf7_%4$s_clear" type="button" value="%7$s" class="fdvo-app-sign-clear"/>
    				</div>
    			</div>
    
    		</div>
    		<span class="wpcf7-form-control-wrap wpcf7-form-control-signature-input-wrap %1$s">
    			<input %2$s id="wpcf7_input_%1$s"/>%3$s
    		</span>
    		',
    		sanitize_html_class( $tag->name ), $atts, $validation_error, $tag->name, $width, $height, __( 'Clear', 'wpcf7-signature' ), $canvas_id, $canvas_class );
    
    	return $html;

    Thanks again!

    Plugin Author tameroski

    (@tameroski)

    Hey there

    1/ Modifying a plugin’s code is a bad practice. The day the plugin is updated, you lose all your modifications.

    2/ You script works but is kinda overwritten by the plugin very own js.

    You need to put your code in your own js file either in your theme or in your own plugin. The theme option is the easiest; just put something like this in your theme’s functions.php :

    function theme_name_scripts() {
    	wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
    }
    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

    And it should be loaded AFTER my plugins scripts.

    Plugin Author tameroski

    (@tameroski)

    Closing topic

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Line and Tag within the Canvas’ is closed to new replies.