| @@ -6,10 +6,8 @@ | ||
| 6 | 6 | class FrmSimpleBlocksController { |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Enqueue Formidable Simple Blocks' js and CSS for editor in admin. |
| 10 | - * | |
| 11 | - * @return void | |
| 12 | 10 | */ |
| 13 | 11 | public static function block_editor_assets() { |
| 14 | 12 | $version = FrmAppHelper::plugin_version(); |
| 15 | 13 | |
| @@ -15,27 +13,19 @@ | ||
| 15 | 13 | |
| 16 | 14 | wp_register_script( |
| 17 | 15 | 'formidable-form-selector', |
| 18 | 16 | FrmAppHelper::plugin_url() . '/js/formidable_blocks.js', |
| 19 | - array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-block-editor' ), | |
| 17 | + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor' ), | |
| 20 | 18 | $version, |
| 21 | 19 | true |
| 22 | 20 | ); |
| 23 | 21 | |
| 24 | - $icon = apply_filters( 'frm_icon', 'svg' ); | |
| 25 | - if ( 0 === strpos( $icon, 'data:image/svg+xml;base64,' ) ) { | |
| 26 | - $icon = ' ' . FrmAppHelper::get_menu_icon_class(); | |
| 27 | - } else { | |
| 28 | - $icon = str_replace( 'dashicons-', '', $icon ); | |
| 29 | - } | |
| 30 | - | |
| 22 | + $icon = str_replace( 'dashicons-', '', apply_filters( 'frm_icon', 'svg' ) ); | |
| 31 | 23 | $block_name = FrmAppHelper::get_menu_name(); |
| 32 | 24 | if ( $block_name === 'Formidable' ) { |
| 33 | 25 | $block_name = 'Formidable Forms'; |
| 34 | 26 | } |
| 35 | 27 | |
| 36 | - $modal_addon = self::get_modal_addon_info(); | |
| 37 | - | |
| 38 | 28 | $script_vars = array( |
| 39 | 29 | 'forms' => self::get_forms_options(), |
| 40 | 30 | 'icon' => $icon, |
| 41 | 31 | 'name' => $block_name, |
| @@ -40,12 +30,8 @@ | ||
| 40 | 30 | 'icon' => $icon, |
| 41 | 31 | 'name' => $block_name, |
| 42 | 32 | 'link' => FrmAppHelper::admin_upgrade_link( 'block' ), |
| 43 | 33 | 'url' => FrmAppHelper::plugin_url(), |
| 44 | - 'modalAddon' => array( | |
| 45 | - 'link' => FrmAppHelper::admin_upgrade_link( 'addons', $modal_addon['link'] ), | |
| 46 | - 'hasAccess' => ! empty( $modal_addon['url'] ), | |
| 47 | - ), | |
| 48 | 34 | ); |
| 49 | 35 | |
| 50 | 36 | wp_localize_script( 'formidable-form-selector', 'formidable_form_selector', $script_vars ); |
| 51 | 37 | if ( function_exists( 'wp_set_script_translations' ) ) { |
| @@ -60,27 +46,8 @@ | ||
| 60 | 46 | ); |
| 61 | 47 | } |
| 62 | 48 | |
| 63 | 49 | /** |
| 64 | - * Gets the modal addon info. | |
| 65 | - * | |
| 66 | - * @since 6.3.2 | |
| 67 | - * | |
| 68 | - * @return array|false | |
| 69 | - */ | |
| 70 | - private static function get_modal_addon_info() { | |
| 71 | - $api = new FrmFormApi(); | |
| 72 | - $addons = $api->get_api_info(); | |
| 73 | - $addon_id = 185013; | |
| 74 | - | |
| 75 | - if ( ! is_array( $addons ) || ! array_key_exists( $addon_id, $addons ) ) { | |
| 76 | - return false; | |
| 77 | - } | |
| 78 | - | |
| 79 | - return $addons[ $addon_id ]; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | 50 | * Returns a filtered list of form options with the name as label and the id as value, sorted by label |
| 84 | 51 | * |
| 85 | 52 | * @return array |
| 86 | 53 | */ |
| @@ -116,10 +83,8 @@ | ||
| 116 | 83 | } |
| 117 | 84 | |
| 118 | 85 | /** |
| 119 | 86 | * Registers simple form block |
| 120 | - * | |
| 121 | - * @return void | |
| 122 | 87 | */ |
| 123 | 88 | public static function register_simple_form_block() { |
| 124 | 89 | if ( ! is_callable( 'register_block_type' ) ) { |
| 125 | 90 | return; |
| @@ -159,9 +124,10 @@ | ||
| 159 | 124 | |
| 160 | 125 | /** |
| 161 | 126 | * Renders a form given the specified attributes. |
| 162 | 127 | * |
| 163 | - * @param array $attributes | |
| 128 | + * @param $attributes | |
| 129 | + * | |
| 164 | 130 | * @return string |
| 165 | 131 | */ |
| 166 | 132 | public static function simple_form_render( $attributes ) { |
| 167 | 133 | if ( ! isset( $attributes['formId'] ) ) { |
| @@ -166,14 +132,8 @@ | ||
| 166 | 132 | public static function simple_form_render( $attributes ) { |
| 167 | 133 | if ( ! isset( $attributes['formId'] ) ) { |
| 168 | 134 | return ''; |
| 169 | 135 | } |
| 170 | - | |
| 171 | - /** | |
| 172 | - * @since 5.5.2 | |
| 173 | - * @param array $attributes | |
| 174 | - */ | |
| 175 | - do_action( 'frm_before_simple_form_render', $attributes ); | |
| 176 | 136 | |
| 177 | 137 | $params = array_filter( $attributes ); |
| 178 | 138 | $params['id'] = $params['formId']; |
| 179 | 139 | unset( $params['formId'] ); |