get_settings_for_display(); $fields = $settings['fields']; $has_address = false; $attr_messages = ''; if ( 'yes' === $settings['messages_custom'] ) { $messages = esc_attr( wp_json_encode( [ 'error' => esc_attr( $settings['messages_error'] ), 'required' => esc_attr( $settings['messages_required'] ), ] ) ); $attr_messages = "data-messages=\"{$messages}\""; } ?>
enqueue_google_places_api(); } } private function button_wrapper_attributes( $settings ) { $this->add_render_attribute( 'button-wrapper', 'class', 'sellkit-field-group sellkit-field-type-submit-button elementor-column elementor-col-' . $settings['submit_button_width'] ); // We add responsive widths as css variables and apply them according to "data-elementor-device-mode" attribute of element. foreach ( Module::get_active_breakpoints() as $device => $value ) { if ( 'desktop' !== $device && empty( $settings[ "submit_button_width_{$device}" ] ) ) { continue; } $setting_key = 'desktop' === $device ? 'submit_button_width' : "submit_button_width_{$device}"; $this->add_render_attribute( 'button-wrapper', 'style', "--sellkit-field-width-{$device}:" . $settings[ $setting_key ] . '%;' ); } return $this->get_render_attribute_string( 'button-wrapper' ); } private static function get_current_post_id() { if ( isset( Elementor::$instance->documents ) && ! empty( Elementor::$instance->documents->get_current() ) ) { return Elementor::$instance->documents->get_current()->get_main_id(); } return get_the_ID(); } private function enqueue_google_places_api() { $options = get_option( 'sellkit' ); /** * Let's make a small migration * * When user updates plugin, once we check if optin is filled, we fill google_api_key field with it. * And we set empty value for it, so next time it will be ignored. * * @todo Should be removed at next version * @since 1.5.7 */ if ( empty( $settings['google_api_key'] ) && array_key_exists( 'google_api_key_optin', $options ) && ! empty( $options['google_api_key_optin'] ) ) { $options['google_api_key'] = $options['google_api_key_optin']; $options['google_api_key_optin'] = ''; update_option( 'sellkit', $options ); } if ( empty( $options ) || empty( $options['google_api_key'] ) ) { return; } $api_key = $options['google_api_key']; wp_enqueue_script( 'sellkit_google_places_api', "https://maps.googleapis.com/maps/api/js?key={$api_key}&libraries=places", [], '1.0.0', false ); } }