OMBGravityFormsMods // Ounce on behalf of Matt Binkowski Gravity Forms Mods.
/**
* OMBGravityFormsMods
*
* Ounce on behalf of Matt Binkowski Gravity Forms Mods.
*
*/
class OMBGravityFormsMods {
function __construct( $args ) {
$args = wp_parse_args( $args, array(
'form_id' => false,
'auto_submit_field_id' => false
) );
foreach( $args as $key => $arg ) {
$this->$key = $arg;
}
add_filter( "gform_pre_render_{$this->form_id}", array( $this, 'pre_render' ) );
}
function pre_render( $form ) {
?>
<style type="text/css">
/* Remove these two (2) lines if you don't want the custom font. */
@import url(http://fonts.googleapis.com/css?family=Pathway+Gothic+One);
.gw-image-labels label { font-weight: normal !important; font-size: 42px; font-family: 'Pathway Gothic One', sans-serif; }
/* ...and stop! Don't remove below this line. */
#gform_<?php echo $form['id']; ?> input[type="submit"] { display: none; }
.gw-image-labels { }
.gw-image-labels input { display: none; }
.gw-image-labels .ginput_container label { margin-left: 0 !important; cursor: pointer; opacity: 0.6; }
.gw-image-labels .ginput_container label:hover { opacity: 1.0; }
</style>
<?php
$script = "(function(\$){ \$(document).on( 'click', '#input_{$form['id']}_{$this->auto_submit_field_id}', function(){ \$(this).parents('form').submit(); }); })(jQuery);";
GFFormDisplay::add_init_script( $form['id'], 'omb', GFFormDisplay::ON_PAGE_RENDER, $script );
return $form;
}
}
new OMBGravityFormsMods( array(
'form_id' => 11,
'auto_submit_field_id' => 1
) );