diff --git a/class-gwiz-gf-code-chest.php b/class-gwiz-gf-code-chest.php index 67da49a..e56fb36 100644 --- a/class-gwiz-gf-code-chest.php +++ b/class-gwiz-gf-code-chest.php @@ -208,17 +208,6 @@ public function init() { load_plugin_textdomain( $this->_slug, false, basename( dirname( __file__ ) ) . '/languages/' ); - if ( current_user_can( 'administrator' ) ) { - add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_editor_script' ) ); - add_action( 'gform_post_save_feed_settings', array( $this, 'save_code_chest_settings' ), 10, 4 ); - add_filter( 'gform_noconflict_scripts', array( $this, 'noconflict_scripts' ) ); - add_filter( 'gform_noconflict_styles', array( $this, 'noconflict_styles' ) ); - - // 11 so that this comes right after and can override the legacy Custom JS plugin setting config. - add_filter( 'gform_form_settings_fields', array( $this, 'replace_custom_js_setting' ), 11, 2 ); - } - add_filter( 'gform_register_init_scripts', array( $this, 'register_init_script' ), 99, 1 ); add_filter( 'gform_register_init_scripts', array( $this, 'maybe_register_custom_js_scripts_first' ), 100, 1 ); @@ -240,6 +229,18 @@ public function init() { add_action( 'gform_post_form_duplicated', array( $this, 'duplicate_form_feeds' ), 10, 2 ); } + public function init_admin() { + parent::init_admin(); + + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_editor_script' ) ); + add_action( 'gform_post_save_feed_settings', array( $this, 'save_code_chest_settings' ), 10, 4 ); + add_filter( 'gform_noconflict_scripts', array( $this, 'noconflict_scripts' ) ); + add_filter( 'gform_noconflict_styles', array( $this, 'noconflict_styles' ) ); + + // 11 so that this comes right after and can override the legacy Custom JS plugin setting config. + add_filter( 'gform_form_settings_fields', array( $this, 'replace_custom_js_setting' ), 11, 2 ); + } + public function enqueue_editor_script() { if ( GFForms::get_page() !== 'form_settings_gf-code-chest' ) { return; @@ -423,17 +424,6 @@ public function get_custom_css( $form ) { return rgar( $settings, 'code_chest_css' ); } - /** - * Registers tooltips with Gravity Forms. Needed for some things like radio choices. - * - * @param $tooltips array Existing tooltips. - * - * @return array - */ - public function tooltips( $tooltips ) { - return $tooltips; - } - public function feed_settings_fields() { $form_id = rgget( 'id' ); $form = GFAPI::get_form( $form_id );