Comments (1)
Just a note that I got this working with latest Gravity Forms and WP by modifying the plugin.
Within the plugin files, go to /classes/Addon.php
-
Change line 167 from private to public function
public function settings_iframe_embed_code( $field, $echo = true ) {
-
Commented out line 173
//$attributes[] = 'readonly="readonly"';
It's a temporary fix, but seemed to work for us.
`<?php
/**
- Gravity Forms Iframe add-on settings.
- @Package GravityFormsIframe
- @copyright Copyright (c) 2016, Cedaro, LLC
- @license GPL-2.0+
- @SInCE 2.0.0
*/
/**
-
The main add-on class.
-
Extends the Gravity Forms add-on class. Functionality that needs access to
-
the add-on API should be encapsulated since most methods and properties are
-
protected.
-
@Package GravityFormsIframe
-
@SInCE 2.0.0
/
class GravityFormsIframe_Addon extends GFAddOn {
/*/**
- Members plugin integration.
- @SInCE 2.0.0
- @var array
*/
protected $_capabilities = array( 'gravityforms_iframe' );
/**
- Form settings capability.
- @SInCE 2.0.0
- @var string
*/
protected $_capabilities_form_settings = 'gravityforms_iframe';
/**
-
Class constructor for setting up the add-on.
-
@SInCE 2.0.0
-
@see GFAddOn
-
@param GravityFormsIframe_Plugin $plugin Main plugin instance.
*/
public function __construct( $plugin ) {
$this->plugin = $plugin;$this->title = esc_html_( 'Gravity Forms Iframe Add-On', 'gravity-forms-iframe' );
$this->short_title = esc_html_( 'Iframe', 'gravity-forms-iframe' );
$this->_version = '2.0.1';
$this->_slug = 'gfiframe';
$this->_path = $this->plugin->get_basename();
$this->_full_path = $this->plugin->get_file();parent::__construct();
}
/**
-
Register add-on scripts.
-
@SInCE 2.0.0
-
@return array
*/
public function scripts() {
$scripts = array(
array(
'handle' => 'gfiframe-settings',
'src' => $this->plugin->get_url( 'assets/scripts/settings.js' ),
'version' => $this->_version,
'deps' => array( 'jquery' ),
'enqueue' => array(
array(
'admin_page' => array( 'form_settings' ),
'tab' => 'gfiframe',
),
),
),
);return array_merge( parent::scripts(), $scripts );
}
/**
- Declare the sections and fields for the iframe add-on.
- @SInCE 2.0.0
- @param array $form Form data.
- @return array
*/
public function form_settings_fields( $form ) {
return array(
array(
'title' => esc_html__( 'Iframe Settings', 'gravity-forms-iframe' ),
'description' => '',
'fields' => array(
array(
'label' => esc_html__( 'Enable embedding', 'gravity-forms-iframe' ),
'type' => 'checkbox',
'name' => 'is_enabled',
'onclick' => '',
'tooltip' => '',
'choices' => array(
array(
'label' => esc_html__( 'Allow this form to be embedded in an iframe', 'gravity-forms-iframe' ),
'name' => 'is_enabled',
),
),
),
array(
'label' => esc_html__( 'Display title', 'gravity-forms-iframe' ),
'type' => 'checkbox',
'name' => 'display_title',
'onclick' => '',
'tooltip' => '',
'choices' => array(
array(
'label' => esc_html__( 'Display title', 'gravity-forms-iframe' ),
'name' => 'display_title',
),
),
),
array(
'label' => esc_html__( 'Display description', 'gravity-forms-iframe' ),
'type' => 'checkbox',
'name' => 'display_description',
'tooltip' => '',
'onclick' => '',
'choices' => array(
array(
'label' => esc_html__( 'Display description', 'gravity-forms-iframe' ),
'name' => 'display_description',
),
),
),
array(
'label' => esc_html__( 'Embed Code', 'gravity-forms-iframe' ),
'type' => 'iframe_embed_code',
'name' => 'embed_code',
'tooltip' => '',
'class' => 'fieldwidth-3 field-height-3',
),
),
),
);
}
/**
-
Render a field for displaying the code to embed a form.
-
@SInCE 2.0.0
-
@param array $field Field array containing the configuration options of this field.
-
@param bool $echo Whether the field should be displayed.
-
@return string
*/
public function settings_iframe_embed_code( $field, $echo = true ) {
$form = $this->get_current_form();$field['type'] = 'iframe_embed_code';
$attributes = $this->get_field_attributes( $field );
//$attributes[] = 'readonly="readonly"';
$attributes[] = 'onfocus="this.select();"';$iframe_url = home_url( '/gfembed/' );
$iframe_url = add_query_arg( 'f', $form['id'], $iframe_url );
$iframe_url = preg_replace( '#^http(s)?:#', '', $iframe_url );// Relative protocol.
$script_url = preg_replace( '#^http(s)?:#', '', $this->plugin->get_url( 'assets/scripts/gfembed.min.js' ) );$value = '<iframe src="' . esc_url( $iframe_url ) . '" width="100%" height="500" frameBorder="0" class="gfiframe"></iframe>' . "\n";
$value .= '<script src="' . esc_url( $script_url ) . '" type="text/javascript"></script>';$tooltip = '';
if ( isset( $choice['tooltip'] ) ) {
$tooltip = gform_tooltip( $choice['tooltip'], rgar( $choice, 'tooltip_class'), true );
}$html = '<textarea ' . implode( ' ', $attributes ) . '>' . esc_textarea( $value ) . '</textarea>';
if ( $echo ) {
echo $html;
}return $html;
}
}
`
from gravity-forms-iframe.
Related Issues (20)
- iframe resize not working. HOT 2
- Getting URL of iframe page HOT 2
- Uncaught TypeError: t.data.split is not a function HOT 1
- Gravity Forms filters (e.g., gform_pre_render, gform_pre_validation, etc.) not working HOT 2
- Style of form embedded HOT 1
- Issue with embedding Gravity form on Clickfunnels page - Can you help please? HOT 1
- Conditional logic & Signature Filed Not working HOT 1
- Iframe works on desktop but not mobile HOT 6
- Thankyou so much HOT 1
- 'X-Frame-Options' to 'sameorigin' Issue HOT 2
- Iframe doesn't show updated form/new changes HOT 1
- iFrame requires login on external site
- Footer issue HOT 1
- enable automatically
- Is this no longer working? iFrames appear empty on any external sites
- Gravity new update, don't work with iframe plugin HOT 6
- Height not resizing to form height HOT 2
- gform_theme_config is not defined
- Not sending form
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gravity-forms-iframe.