Created
July 7, 2023 18:31
-
-
Save matty0501/d451c35f8cf656bc197cbfd14de6ec00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gravity Perks // Populate Anything // Populate Pipe Video URL | |
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/ | |
* | |
* By default, when populating a Pipe field's value, the Pipe add-on returns an array which includes the video URL and a thumbnail. | |
* This snippet allows you to just populate the video URL. | |
* Just add the "gppa-pipe-video" CSS class to the populated field's CSS Class Name setting. | |
*/ | |
add_filter( 'gppa_process_template_value', function( $template_value, $field ) { | |
if ( strpos( $field->cssClass, 'gppa-pipe-video' ) !== false ) { | |
$parts = explode(',', $template_value); | |
$template_value = str_replace( ' ', '', $parts[1] ); | |
} | |
return $template_value; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment