Single Page Edit

Remove page breaks from Entry Blocks edit form.

Code

Filename: gpeb-single-page-edit.php

<?php
/**
 * Gravity Perks // Entry Blocks // Single Page Edit
 * https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
 *
 * Remove page breaks from Entry Blocks edit form.
 */
add_filter( 'gform_pre_render', function( $form ) {

	$is_block = (bool) rgpost( 'gpeb_entry_id' );
	if ( ! $is_block ) {
		$is_block = class_exists( 'WP_Block_Supports' ) && rgar( WP_Block_Supports::$block_to_render, 'blockName' ) === 'gp-entry-blocks/edit-form';
		if ( ! $is_block ) {
			return $form;
		}
	}

	$fields = array();

	foreach ( $form['fields'] as $field ) {
		if ( $field->type !== 'page' ) {
			$fields[] = $field;
		}
	}

	$form['fields'] = $fields;

	return $form;
} );

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.