Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Inline Edit by GravityView - Modify the Inline Edit behavior to auto-show inputs
<?php
/**
* Modify the Inline Edit behavior
*/
add_filter( 'gravityview-inline-edit/js-settings', function ( $js_settings ) {
$js_settings['showbuttons'] = false; // Auto-update when changed
$js_settings['onblur'] = 'ignore';
// Show inputs for _all_ fields
$js_settings['showinputs'] = true;
// Show the input for only one field
// @see http://share.gravityview.co/UMiZi0/3EdmaT23 for example
/*
$field_id = 12;
$form_id = 37;
$js_settings['showinputs'] = sprintf( '.editable[data-fieldid="%d"][data-formid="%d"]', $field_id, $form_id );
*/
/*
// Show only specific field types
$field_types = array( 'select', 'checklist', 'text' );
$selectors = array();
foreach ( $field_types as $field_type ) {
$selectors[] = '.editable[data-type="' . $field_type . '"]';
}
$js_settings['showinputs'] = implode( ',', $selectors );
*/
return $js_settings;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.