Force Read Only Fields to not be editable on User Input Step

Code

Filename: gflow-force-read-only-not-editable-on-user-input-step.php

<?php
/**
 * Gravity Forms // Gravity Flow // Force Read Only Fields to not be editable on User Input Step
 * https://gravitywiz.com/
 */
add_filter( 'gravityflow_editable_fields_user_input', function( $editable_fields, $step ) {
	foreach ( $editable_fields as $key => $potential ) {
		$field = GFFormsModel::get_field( $step->get_form_id(), $potential );
		//Use cases may also want to evaluate $field['isRequired']
		if ( $field['gwreadonly_enable'] ) {
			unset( $editable_fields[ $key ] );
		}
	}

	return $editable_fields;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.