diff --git a/Gruntfile.js b/Gruntfile.js
index 5ee88b106..5a37cb828 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -28,7 +28,8 @@ module.exports = function( grunt) {
// one to one
front: {
files: {
- '<%= dirs.css %>/frontend-forms.css': '<%= dirs.less %>/frontend-forms.less'
+ '<%= dirs.css %>/frontend-forms.css': '<%= dirs.less %>/frontend-forms.less',
+ '<%= dirs.css %>/elementor-frontend-forms.css': '<%= dirs.less %>/elementor-frontend-forms.less'
}
},
diff --git a/assets/css/elementor-frontend-forms.css b/assets/css/elementor-frontend-forms.css
new file mode 100644
index 000000000..c46f8e910
--- /dev/null
+++ b/assets/css/elementor-frontend-forms.css
@@ -0,0 +1,197 @@
+/**
+ * DESCRIPTION: Elementor-specific WPUF frontend form styles
+ *
+ * This file contains form styles scoped to the Elementor widget wrapper
+ * to avoid conflicts with the theme and provide better Elementor integration.
+ *
+ * @package WPUF\Elementor
+ */
+.wpuf-elementor-widget-wrapper {
+ --wpuf-border-color: #dadbdd;
+ --wpuf-border-radius: 7px;
+ --wpuf-text-color: #606266;
+ --wpuf-primary-color: #1a7efb;
+ --wpuf-danger-color: #F56C6C;
+}
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="text"],
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="email"],
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="url"],
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="password"],
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="number"],
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="tel"],
+.wpuf-elementor-widget-wrapper .wpuf-fields textarea,
+.wpuf-elementor-widget-wrapper .wpuf-fields select {
+ padding: 12px 15px;
+ color: var(--wpuf-text-color);
+ border: 1px solid var(--wpuf-border-color);
+ border-radius: var(--wpuf-border-radius);
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+ margin-bottom: 0;
+ width: 100%;
+}
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="text"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="email"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="url"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="password"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="number"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields input[type="tel"]:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields textarea:focus,
+.wpuf-elementor-widget-wrapper .wpuf-fields select:focus {
+ color: var(--wpuf-text-color);
+ background-color: #fff;
+ border-color: var(--wpuf-primary-color);
+ outline: none;
+ box-shadow: 0 0 0 2px rgba(26, 126, 251, 0.1);
+}
+.wpuf-elementor-widget-wrapper .wpuf-fields .wpuf-radio-block,
+.wpuf-elementor-widget-wrapper .wpuf-fields .wpuf-checkbox-block {
+ display: flex;
+ align-items: center;
+ margin-bottom: 6px;
+}
+.wpuf-elementor-widget-wrapper ul.wpuf-form {
+ list-style: none;
+}
+.wpuf-elementor-widget-wrapper ul.wpuf-form li:not(:first-child) {
+ margin-top: 2rem;
+}
+.wpuf-elementor-widget-wrapper ul.wpuf-form li.wpuf-el .wpuf-label {
+ margin-bottom: 1rem;
+}
+.wpuf-elementor-widget-wrapper[data-align="left"] {
+ margin: 0 auto 0 0;
+}
+.wpuf-elementor-widget-wrapper[data-align="center"] {
+ margin: 0 auto;
+}
+.wpuf-elementor-widget-wrapper[data-align="right"] {
+ margin: 0 0 0 auto;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-submit-full .wpuf-submit .wpuf-submit-button {
+ width: 100%;
+ display: block;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-upload-full .wpuf-attachment-upload-filelist .file-selector {
+ width: 100%;
+ display: block;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-labels .wpuf-label {
+ display: none !important;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-errors .wpuf-error,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-errors .error {
+ display: none;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder input::-webkit-input-placeholder,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder textarea::-webkit-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder input::-moz-placeholder,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder textarea::-moz-placeholder {
+ opacity: 0;
+ visibility: hidden;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder input:-moz-placeholder,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder textarea:-moz-placeholder {
+ opacity: 0;
+ visibility: hidden;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder input:-ms-input-placeholder,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder textarea:-ms-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder input::-ms-input-placeholder,
+.wpuf-elementor-widget-wrapper.wpuf-elementor-hide-placeholder textarea::-ms-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-custom-radio-checkbox input[type="checkbox"],
+.wpuf-elementor-widget-wrapper.wpuf-elementor-custom-radio-checkbox input[type="radio"] {
+ outline: none;
+ min-width: 1px;
+ width: 15px;
+ height: 15px;
+ background: #ddd;
+ padding: 3px;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-custom-radio-checkbox input[type="radio"] {
+ border-radius: 50%;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-submit-center .wpuf-submit {
+ text-align: center;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-submit-center .wpuf-submit .wpuf-submit-button {
+ margin: 0 auto;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-submit-right .wpuf-submit {
+ text-align: right;
+}
+.wpuf-elementor-widget-wrapper.wpuf-elementor-submit-left .wpuf-submit {
+ text-align: left;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .refresh {
+ cursor: pointer;
+ transition: opacity 0.2s ease;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .refresh:hover {
+ opacity: 0.7;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .refresh svg {
+ display: block;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .captcha-number-area .captcha-number {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ margin: 0;
+ font-size: 16px;
+ font-weight: 500;
+ color: var(--wpuf-text-color);
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .captcha-equal {
+ font-size: 18px;
+ font-weight: 600;
+ color: var(--wpuf-text-color);
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .wpuf-captcha-input-wrapper {
+ flex: 1;
+ min-width: 80px;
+ position: relative;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .wpuf-captcha-input-wrapper .wpuf-captcha-input {
+ padding: 11px 15px;
+ color: var(--wpuf-text-color);
+ border: 1px solid var(--wpuf-border-color);
+ border-radius: var(--wpuf-border-radius);
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+ margin-bottom: 0;
+ width: 100%;
+ font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .wpuf-captcha-input-wrapper .wpuf-captcha-input:focus {
+ color: var(--wpuf-text-color);
+ background-color: #fff;
+ border-color: var(--wpuf-primary-color);
+ outline: none;
+ box-shadow: 0 0 0 2px rgba(26, 126, 251, 0.1);
+}
+.wpuf-elementor-widget-wrapper .wpuf-math-captcha .captcha .wpuf-captcha-input-wrapper .wpuf-captcha-error {
+ display: block;
+ margin-top: 5px;
+ font-size: 13px;
+ color: var(--wpuf-danger-color);
+}
+.lity {
+ z-index: 9999 !important;
+}
diff --git a/assets/css/elementor-subscription-plans.css b/assets/css/elementor-subscription-plans.css
new file mode 100644
index 000000000..53d3c8301
--- /dev/null
+++ b/assets/css/elementor-subscription-plans.css
@@ -0,0 +1,195 @@
+/**
+ * DESCRIPTION: Elementor-specific WPUF subscription plans styles
+ *
+ * This file contains subscription plans display styles scoped to the
+ * Elementor widget wrapper to avoid conflicts with the theme.
+ * Design values (colors, fonts, spacing) are controlled by Elementor widget settings.
+ *
+ * @package WPUF\Elementor
+ */
+
+/* Widget Container */
+.wpuf-subscription-plans-wrapper {
+ width: 100%;
+ margin: 0 auto;
+}
+
+/* Grid Layout */
+.wpuf-subscription-plans-grid {
+ display: grid;
+}
+
+/* Responsive: Mobile - 1 column */
+@media (max-width: 767px) {
+ .wpuf-subscription-plans-grid {
+ grid-template-columns: 1fr;
+ }
+}
+
+/* Plans Per Row: 1 column */
+.wpuf-subscription-plans-wrapper.wpuf-sub-plans-1 .wpuf-subscription-plans-grid {
+ grid-template-columns: 1fr;
+}
+
+/* Plans Per Row: 2 columns */
+@media (min-width: 768px) {
+ .wpuf-subscription-plans-wrapper.wpuf-sub-plans-2 .wpuf-subscription-plans-grid {
+ grid-template-columns: repeat(2, 1fr);
+ }
+}
+
+/* Plans Per Row: 3 columns */
+@media (min-width: 768px) {
+ .wpuf-subscription-plans-wrapper.wpuf-sub-plans-3 .wpuf-subscription-plans-grid {
+ grid-template-columns: repeat(3, 1fr);
+ }
+}
+
+/* Plans Per Row: 4 columns */
+@media (min-width: 768px) {
+ .wpuf-subscription-plans-wrapper.wpuf-sub-plans-4 .wpuf-subscription-plans-grid {
+ grid-template-columns: repeat(4, 1fr);
+ }
+}
+
+/* Plan Card */
+.wpuf-sub-card {
+ transition: box-shadow 0.3s ease, transform 0.3s ease;
+}
+
+.wpuf-sub-card:hover {
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
+}
+
+/* Plan Name */
+.wpuf-sub-plan-name {
+ margin: 0 0 0 0;
+ line-height: 1.3;
+}
+
+/* Description */
+.wpuf-sub-description {
+ margin-bottom: 20px;
+ line-height: 1.6;
+}
+
+.wpuf-sub-description p {
+ margin: 0 0 12px 0;
+}
+
+.wpuf-sub-description p:last-child {
+ margin-bottom: 0;
+}
+
+/* Price Wrapper */
+.wpuf-sub-price-wrapper {
+ margin-bottom: 20px;
+}
+
+/* Price */
+.wpuf-sub-price {
+ display: flex;
+ align-items: baseline;
+ flex-wrap: wrap;
+ gap: 4px;
+ line-height: 1.2;
+}
+
+/* Trial Description */
+.wpuf-sub-trial-description {
+ margin-bottom: 20px;
+ line-height: 1.5;
+}
+
+/* Button Wrapper */
+.wpuf-sub-button-wrapper {
+ margin-bottom: 20px;
+}
+
+/* Subscribe Button */
+.wpuf-sub-button {
+ display: inline-block;
+ text-align: center;
+ text-decoration: none;
+ transition: all 0.2s ease;
+ cursor: pointer;
+}
+
+.wpuf-sub-button:hover {
+ opacity: 0.9;
+}
+
+.wpuf-sub-button-disabled {
+ opacity: 0.6;
+ cursor: not-allowed;
+ pointer-events: none;
+}
+
+/* Features List */
+.wpuf-sub-features-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+.wpuf-sub-feature-item {
+ display: flex;
+ align-items: flex-start;
+ gap: 12px;
+ line-height: 1.5;
+}
+
+.wpuf-sub-feature-item:last-child {
+ margin-bottom: 0;
+}
+
+.wpuf-sub-feature-icon {
+ flex-shrink: 0;
+ margin-top: 2px;
+}
+
+.wpuf-sub-feature-hidden {
+ display: none;
+}
+
+/* Features Toggle Button */
+.wpuf-sub-features-toggle-wrapper {
+ margin-top: 16px;
+}
+
+.wpuf-sub-features-toggle {
+ background: none;
+ border: none;
+ padding: 0;
+ cursor: pointer;
+ text-decoration: none;
+ transition: opacity 0.2s ease;
+}
+
+.wpuf-sub-features-toggle:hover {
+ opacity: 0.8;
+}
+
+/* Empty State (Editor) */
+.wpuf-subscription-empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 60px 20px;
+ text-align: center;
+ border: 2px dashed #d1d5db;
+ border-radius: 12px;
+}
+
+.wpuf-subscription-empty-icon {
+ margin-bottom: 16px;
+}
+
+.wpuf-subscription-empty-text {
+ margin: 0 0 8px 0;
+}
+
+.wpuf-subscription-empty-hint {
+ margin: 0;
+}
diff --git a/assets/js/elementor-subscription-plans.js b/assets/js/elementor-subscription-plans.js
new file mode 100644
index 000000000..32042b79c
--- /dev/null
+++ b/assets/js/elementor-subscription-plans.js
@@ -0,0 +1,44 @@
+/**
+ * DESCRIPTION: Elementor subscription plans widget JavaScript
+ *
+ * Handles the expandable features list functionality for the
+ * subscription plans widget.
+ *
+ * @package WPUF\Elementor
+ */
+
+(function() {
+ 'use strict';
+
+ // Handle feature toggle buttons
+ document.addEventListener('click', function(e) {
+ if (e.target.classList.contains('wpuf-sub-features-toggle')) {
+ e.preventDefault();
+ var button = e.target;
+ var packId = button.getAttribute('data-pack-id');
+ var isExpanded = button.getAttribute('data-expanded') === 'true';
+ var featuresList = document.getElementById('wpuf-sub-features-list-' + packId);
+ var seeMoreBtn = featuresList.parentElement.querySelector('.wpuf-sub-features-see-more');
+ var seeLessBtn = featuresList.parentElement.querySelector('.wpuf-sub-features-see-less');
+ var hiddenItems = featuresList.querySelectorAll('.wpuf-sub-feature-hidden');
+
+ if (isExpanded) {
+ // Collapse
+ hiddenItems.forEach(function(item) {
+ item.style.display = 'none';
+ });
+ seeMoreBtn.style.display = '';
+ seeLessBtn.style.display = 'none';
+ button.setAttribute('data-expanded', 'false');
+ } else {
+ // Expand
+ hiddenItems.forEach(function(item) {
+ item.style.display = 'flex';
+ });
+ seeMoreBtn.style.display = 'none';
+ seeLessBtn.style.display = '';
+ seeLessBtn.setAttribute('data-expanded', 'true');
+ }
+ }
+ });
+})();
diff --git a/assets/less/elementor-frontend-forms.less b/assets/less/elementor-frontend-forms.less
new file mode 100644
index 000000000..553e0973c
--- /dev/null
+++ b/assets/less/elementor-frontend-forms.less
@@ -0,0 +1,254 @@
+/**
+ * DESCRIPTION: Elementor-specific WPUF frontend form styles
+ *
+ * This file contains form styles scoped to the Elementor widget wrapper
+ * to avoid conflicts with the theme and provide better Elementor integration.
+ *
+ * @package WPUF\Elementor
+ */
+
+// ============================================
+// CSS Custom Properties (Variables)
+// ============================================
+
+.wpuf-elementor-widget-wrapper {
+ --wpuf-border-color: #dadbdd;
+ --wpuf-border-radius: 7px;
+ --wpuf-text-color: #606266;
+ --wpuf-primary-color: #1a7efb;
+ --wpuf-danger-color: #F56C6C;
+
+ // ============================================
+ // Base Input Styles
+ // ============================================
+
+ .wpuf-fields input[type="text"],
+ .wpuf-fields input[type="email"],
+ .wpuf-fields input[type="url"],
+ .wpuf-fields input[type="password"],
+ .wpuf-fields input[type="number"],
+ .wpuf-fields input[type="tel"],
+ .wpuf-fields textarea,
+ .wpuf-fields select {
+ padding: 12px 15px;
+ color: var(--wpuf-text-color);
+ border: 1px solid var(--wpuf-border-color);
+ border-radius: var(--wpuf-border-radius);
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+ margin-bottom: 0;
+ width: 100%;
+
+ &:focus {
+ color: var(--wpuf-text-color);
+ background-color: #fff;
+ border-color: var(--wpuf-primary-color);
+ outline: none;
+ box-shadow: 0 0 0 2px rgba(26, 126, 251, 0.1);
+ }
+ }
+
+ .wpuf-fields .wpuf-radio-block,
+ .wpuf-fields .wpuf-checkbox-block {
+ display: flex;
+ align-items: center;
+ margin-bottom: 6px;
+ }
+
+ ul.wpuf-form {
+ list-style: none;
+
+ li:not(:first-child) {
+ margin-top: 2rem;
+ }
+
+ li.wpuf-el {
+ .wpuf-label {
+ margin-bottom: 1rem;
+ }
+
+ }
+ }
+
+ // Container alignment based on data-align attribute
+ &[data-align="left"] {
+ margin: 0 auto 0 0;
+ }
+
+ &[data-align="center"] {
+ margin: 0 auto;
+ }
+
+ &[data-align="right"] {
+ margin: 0 0 0 auto;
+ }
+
+ // Full width submit button
+ &.wpuf-elementor-submit-full .wpuf-submit .wpuf-submit-button {
+ width: 100%;
+ display: block;
+ }
+
+ // Full width upload button
+ &.wpuf-elementor-upload-full .wpuf-attachment-upload-filelist .file-selector {
+ width: 100%;
+ display: block;
+ }
+
+ // Hide labels option
+ &.wpuf-elementor-hide-labels .wpuf-label {
+ display: none !important;
+ }
+
+ // Hide error messages option
+ &.wpuf-elementor-hide-errors .wpuf-error,
+ &.wpuf-elementor-hide-errors .error {
+ display: none;
+ }
+
+ // Hide placeholder option
+ &.wpuf-elementor-hide-placeholder input::-webkit-input-placeholder,
+ &.wpuf-elementor-hide-placeholder textarea::-webkit-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ &.wpuf-elementor-hide-placeholder input::-moz-placeholder,
+ &.wpuf-elementor-hide-placeholder textarea::-moz-placeholder {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ &.wpuf-elementor-hide-placeholder input:-moz-placeholder,
+ &.wpuf-elementor-hide-placeholder textarea:-moz-placeholder {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ &.wpuf-elementor-hide-placeholder input:-ms-input-placeholder,
+ &.wpuf-elementor-hide-placeholder textarea:-ms-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ &.wpuf-elementor-hide-placeholder input::-ms-input-placeholder,
+ &.wpuf-elementor-hide-placeholder textarea::-ms-input-placeholder {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ // Custom radio/checkbox styling
+ &.wpuf-elementor-custom-radio-checkbox input[type="checkbox"],
+ &.wpuf-elementor-custom-radio-checkbox input[type="radio"] {
+ outline: none;
+ min-width: 1px;
+ width: 15px;
+ height: 15px;
+ background: #ddd;
+ padding: 3px;
+ }
+
+ &.wpuf-elementor-custom-radio-checkbox input[type="radio"] {
+ border-radius: 50%;
+ }
+
+ // Submit button alignment
+ &.wpuf-elementor-submit-center .wpuf-submit {
+ text-align: center;
+
+ .wpuf-submit-button {
+ margin: 0 auto;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+
+ &.wpuf-elementor-submit-right .wpuf-submit {
+ text-align: right;
+ }
+
+ &.wpuf-elementor-submit-left .wpuf-submit {
+ text-align: left;
+ }
+
+ // ============================================
+ // Math Captcha Styles
+ // ============================================
+
+ .wpuf-math-captcha {
+ .captcha {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+
+ .refresh {
+ cursor: pointer;
+ transition: opacity 0.2s ease;
+
+ &:hover {
+ opacity: 0.7;
+ }
+
+ svg {
+ display: block;
+ }
+ }
+
+ .captcha-number-area {
+ .captcha-number {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ margin: 0;
+ font-size: 16px;
+ font-weight: 500;
+ color: var(--wpuf-text-color);
+ }
+ }
+
+ .captcha-equal {
+ font-size: 18px;
+ font-weight: 600;
+ color: var(--wpuf-text-color);
+ }
+
+ .wpuf-captcha-input-wrapper {
+ flex: 1;
+ min-width: 80px;
+ position: relative;
+
+ .wpuf-captcha-input {
+ padding: 11px 15px;
+ color: var(--wpuf-text-color);
+ border: 1px solid var(--wpuf-border-color);
+ border-radius: var(--wpuf-border-radius);
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+ margin-bottom: 0;
+ width: 100%;
+ font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
+
+ &:focus {
+ color: var(--wpuf-text-color);
+ background-color: #fff;
+ border-color: var(--wpuf-primary-color);
+ outline: none;
+ box-shadow: 0 0 0 2px rgba(26, 126, 251, 0.1);
+ }
+ }
+
+ .wpuf-captcha-error {
+ display: block;
+ margin-top: 5px;
+ font-size: 13px;
+ color: var(--wpuf-danger-color);
+ }
+ }
+ }
+ }
+}
+
+// Ensure lity popup appears above Elementor popup
+.lity {
+ z-index: 9999 !important;
+}
\ No newline at end of file
diff --git a/includes/Admin/template-parts/modal-v4.2.php b/includes/Admin/template-parts/modal-v4.2.php
index 94e668198..dab721df6 100644
--- a/includes/Admin/template-parts/modal-v4.2.php
+++ b/includes/Admin/template-parts/modal-v4.2.php
@@ -454,8 +454,6 @@ class="wpuf-btn-secondary wpuf-w-max wpuf-absolute wpuf-top-[50%] wpuf-left-[50%
$( '.wpuf-ai-forms-template a' ).on( 'click', $.proxy( this.handleAIFormsClick, this ) );
$( '#ai-config-cancel' ).on( 'click', $.proxy( this.closeAIConfigModal, this ) );
$( '#ai-config-settings' ).on( 'click', $.proxy( this.goToSettings, this ) );
- } else {
- console.log('NOT attaching AI click handler - AI is configured or template not found');
}
},
diff --git a/includes/Assets.php b/includes/Assets.php
index aa9a20372..f28e1005b 100644
--- a/includes/Assets.php
+++ b/includes/Assets.php
@@ -109,6 +109,12 @@ public function get_styles() {
'frontend-forms' => [
'src' => WPUF_ASSET_URI . '/css/frontend-forms.css',
],
+ 'elementor-frontend-forms' => [
+ 'src' => WPUF_ASSET_URI . '/css/elementor-frontend-forms.css',
+ ],
+ 'elementor-subscription-plans' => [
+ 'src' => WPUF_ASSET_URI . '/css/elementor-subscription-plans.css',
+ ],
'frontend-subscriptions' => [
'src' => WPUF_ASSET_URI . '/css/frontend-subscriptions.min.css',
],
@@ -415,6 +421,10 @@ public function get_scripts() {
'src' => WPUF_ASSET_URI . '/js/frontend-subscriptions.min.js',
'in_footer' => true,
],
+ 'elementor-subscription-plans' => [
+ 'src' => WPUF_ASSET_URI . '/js/elementor-subscription-plans.js',
+ 'in_footer' => true,
+ ],
];
if ( ! empty( $api_key ) ) {
diff --git a/includes/Fields/Field_Contract.php b/includes/Fields/Field_Contract.php
index 007de51df..f3b3bbb10 100755
--- a/includes/Fields/Field_Contract.php
+++ b/includes/Fields/Field_Contract.php
@@ -763,6 +763,33 @@ public function get_default_textarea_option_settings() {
];
}
+ /**
+ * Check if we should render admin-style markup
+ *
+ * Returns true for admin dashboard, but false for Elementor editor
+ * since Elementor editor needs frontend-style markup for proper preview.
+ *
+ * @since WPUF_SINCE
+ *
+ * @return bool
+ */
+ protected function use_admin_markup() {
+ if ( ! is_admin() ) {
+ return false;
+ }
+
+ // Check if we're in Elementor editor mode
+ // Elementor editor needs frontend markup for proper preview
+ if ( class_exists( '\Elementor\Plugin' ) ) {
+ $elementor = \Elementor\Plugin::$instance;
+ if ( $elementor && $elementor->editor && $elementor->editor->is_edit_mode() ) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
/**
* Prints form input label for admin
*
@@ -770,7 +797,7 @@ public function get_default_textarea_option_settings() {
* @param int $form_id
*/
public function field_print_label( $field, $form_id = 0 ) {
- if ( is_admin() ) { ?>
+ if ( $this->use_admin_markup() ) { ?>
print_list_attributes( $field ); ?>> | required_mark( $field ) ); ?> |
@@ -782,7 +809,7 @@ public function field_print_label( $field, $form_id = 0 ) {
}
public function after_field_print_label() {
- if ( is_admin() ) {
+ if ( $this->use_admin_markup() ) {
?>
|
diff --git a/includes/Fields/Form_Field_Post_Excerpt.php b/includes/Fields/Form_Field_Post_Excerpt.php
index b3d8c9aae..636853bc9 100755
--- a/includes/Fields/Form_Field_Post_Excerpt.php
+++ b/includes/Fields/Form_Field_Post_Excerpt.php
@@ -56,6 +56,7 @@ public function render( $field_settings, $form_id, $type = 'post', $post_id = nu
];
$editor_settings = apply_filters( 'wpuf_textarea_editor_args', $editor_settings );
+
wp_editor( $value, $textarea_id, $editor_settings );
} elseif ( ! empty( $field_settings['rich'] ) && $field_settings['rich'] == 'teeny' ) {
$editor_settings = [
@@ -68,6 +69,7 @@ public function render( $field_settings, $form_id, $type = 'post', $post_id = nu
];
$editor_settings = apply_filters( 'wpuf_textarea_editor_args', $editor_settings );
+
wp_editor( $value, $textarea_id, $editor_settings );
} else {
?>
diff --git a/includes/Frontend.php b/includes/Frontend.php
index 908332727..9785e13bf 100644
--- a/includes/Frontend.php
+++ b/includes/Frontend.php
@@ -68,8 +68,11 @@ public function enqueue_scripts() {
// Load appropriate subscription script based on shortcode
if ( wpuf_has_shortcode( 'wpuf_sub_pack' ) ) {
- // Load new frontend-subscriptions script for subscription pack shortcode (pricing page)
- wp_enqueue_style( 'wpuf-frontend-subscriptions' );
+ // Skip loading frontend-subscriptions CSS on Elementor pages (Elementor widget has its own CSS)
+ $is_elementor_page = did_action( 'elementor/loaded' ) && isset( $post->ID ) && \Elementor\Plugin::$instance->db->is_built_with_elementor( $post->ID );
+ if ( ! $is_elementor_page ) {
+ wp_enqueue_style( 'wpuf-frontend-subscriptions' );
+ }
wp_enqueue_script( 'wpuf-frontend-subscriptions' );
} else {
// Load old subscriptions script for all other pages (dashboard, account, etc.)
diff --git a/includes/Integrations.php b/includes/Integrations.php
index 99bb8ea77..eca318303 100644
--- a/includes/Integrations.php
+++ b/includes/Integrations.php
@@ -45,6 +45,10 @@ public function __construct() {
}
}
}
+
+ add_action('elementor/init', function() {
+ $this->container['elementor'] = new Integrations\Elementor\Elementor();
+ });
}
/**
diff --git a/includes/Integrations/Elementor/Elementor.php b/includes/Integrations/Elementor/Elementor.php
new file mode 100644
index 000000000..40e5e87af
--- /dev/null
+++ b/includes/Integrations/Elementor/Elementor.php
@@ -0,0 +1,261 @@
+enqueue_wpuf_form_assets();
+
+ // Ensure editor scripts are loaded for TinyMCE in Elementor preview
+ if ( function_exists( 'wp_enqueue_editor' ) ) {
+ wp_enqueue_editor();
+
+ // Also explicitly enqueue TinyMCE scripts if available
+ if ( function_exists( 'wp_enqueue_script' ) ) {
+ // Check if these scripts exist and enqueue them
+ global $wp_scripts;
+ if ( isset( $wp_scripts->registered['tinymce'] ) ) {
+ wp_enqueue_script( 'tinymce' );
+ }
+ if ( isset( $wp_scripts->registered['wp-tinymce'] ) ) {
+ wp_enqueue_script( 'wp-tinymce' );
+ }
+ }
+ }
+
+ /**
+ * Fires after WPUF has enqueued its scripts in Elementor context.
+ *
+ * @since WPUF_SINCE
+ */
+ do_action( 'wpuf_elementor_after_enqueue_scripts' );
+ }
+
+ /**
+ * Enqueue all required WPUF form assets for Elementor
+ *
+ * Ensures all necessary styles and scripts are loaded for WPUF forms
+ * to render properly in Elementor preview and frontend.
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ private function enqueue_wpuf_form_assets() {
+ // Core styles (already handled by enqueue_styles, but ensure they're available)
+ wp_enqueue_style( 'wpuf-sweetalert2' );
+ wp_enqueue_style( 'wpuf-jquery-ui' );
+
+ // Core scripts required for all WPUF forms
+ wp_enqueue_script( 'suggest' );
+ wp_enqueue_script( 'wpuf-billing-address' );
+ wp_enqueue_script( 'wpuf-upload' );
+ wp_enqueue_script( 'wpuf-frontend-form' );
+ wp_enqueue_script( 'wpuf-sweetalert2' );
+ wp_enqueue_script( 'wpuf-subscriptions' );
+
+ // Localize wpuf-upload script
+ wp_localize_script(
+ 'wpuf-upload',
+ 'wpuf_upload',
+ [
+ 'confirmMsg' => __( 'Are you sure?', 'wp-user-frontend' ),
+ 'delete_it' => __( 'Yes, delete it', 'wp-user-frontend' ),
+ 'cancel_it' => __( 'No, cancel it', 'wp-user-frontend' ),
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
+ 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
+ 'plupload' => [
+ 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf-upload-nonce' ),
+ 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
+ 'filters' => [
+ [
+ 'title' => __( 'Allowed Files', 'wp-user-frontend' ),
+ 'extensions' => '*',
+ ],
+ ],
+ 'multipart' => true,
+ 'urlstream_upload' => true,
+ 'warning' => __( 'Maximum number of files reached!', 'wp-user-frontend' ),
+ 'size_error' => __( 'The file you have uploaded exceeds the file size limit. Please try again.', 'wp-user-frontend' ),
+ 'type_error' => __( 'You have uploaded an incorrect file type. Please try again.', 'wp-user-frontend' ),
+ ],
+ ]
+ );
+
+ // Localize wpuf-frontend-form script
+ wp_localize_script(
+ 'wpuf-frontend-form',
+ 'wpuf_frontend',
+ apply_filters(
+ 'wpuf_frontend_object',
+ [
+ 'asset_url' => WPUF_ASSET_URI,
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
+ 'error_message' => __( 'Please fix the errors to proceed', 'wp-user-frontend' ),
+ 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
+ 'word_limit' => __( 'Word limit reached', 'wp-user-frontend' ),
+ 'cancelSubMsg' => __( 'Are you sure you want to cancel your current subscription ?', 'wp-user-frontend' ),
+ 'delete_it' => __( 'Yes', 'wp-user-frontend' ),
+ 'cancel_it' => __( 'No', 'wp-user-frontend' ),
+ 'word_max_title' => __( 'Maximum word limit reached. Please shorten your texts.', 'wp-user-frontend' ),
+ 'word_max_details' => __( 'This field supports a maximum of %number% words, and the limit is reached. Remove a few words to reach the acceptable limit of the field.', 'wp-user-frontend' ),
+ 'word_min_title' => __( 'Minimum word required.', 'wp-user-frontend' ),
+ 'word_min_details' => __( 'This field requires minimum %number% words. Please add some more text.', 'wp-user-frontend' ),
+ 'char_max_title' => __( 'Maximum character limit reached. Please shorten your texts.', 'wp-user-frontend' ),
+ 'char_max_details' => __( 'This field supports a maximum of %number% characters, and the limit is reached. Remove a few characters to reach the acceptable limit of the field.', 'wp-user-frontend' ),
+ 'char_min_title' => __( 'Minimum character required.', 'wp-user-frontend' ),
+ 'char_min_details' => __( 'This field requires minimum %number% characters. Please add some more character.', 'wp-user-frontend' ),
+ 'protected_shortcodes' => wpuf_get_protected_shortcodes(),
+ 'protected_shortcodes_message' => __( 'Using %shortcode% is restricted', 'wp-user-frontend' ),
+ 'password_warning_weak' => __( 'Your password should be at least weak in strength', 'wp-user-frontend' ),
+ 'password_warning_medium' => __( 'Your password needs to be medium strength for better protection', 'wp-user-frontend' ),
+ 'password_warning_strong' => __( 'Create a strong password for maximum security', 'wp-user-frontend' ),
+ ]
+ )
+ );
+
+ wp_localize_script(
+ 'wpuf-frontend-form',
+ 'error_str_obj',
+ [
+ 'required' => __( 'is required', 'wp-user-frontend' ),
+ 'mismatch' => __( 'does not match', 'wp-user-frontend' ),
+ 'validation' => __( 'is not valid', 'wp-user-frontend' ),
+ ]
+ );
+
+ // Localize subscription script
+ wp_localize_script(
+ 'wpuf-subscriptions',
+ 'wpuf_subscription',
+ apply_filters(
+ 'wpuf_subscription_js_data',
+ [
+ 'pack_notice' => __( 'Please Cancel Your Currently Active Pack first!', 'wp-user-frontend' ),
+ ]
+ )
+ );
+
+ // Localize billing address script
+ wp_localize_script(
+ 'wpuf-billing-address',
+ 'ajax_object',
+ [
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
+ 'fill_notice' => __( 'Some Required Fields are not filled!', 'wp-user-frontend' ),
+ ]
+ );
+
+ // Conditionally enqueue Google Maps if API key is configured
+ $api_key = wpuf_get_option( 'gmap_api_key', 'wpuf_general' );
+ if ( ! empty( $api_key ) ) {
+ $scheme = is_ssl() ? 'https' : 'http';
+ wp_enqueue_script( 'wpuf-google-maps', $scheme . '://maps.google.com/maps/api/js?libraries=places&key=' . $api_key, [], null, true );
+ }
+ }
+
+ /**
+ * Register Elementor Widget Category
+ *
+ * @param \Elementor\Elements_Manager $elements_manager
+ *
+ * @return void
+ */
+ public function register_category( $elements_manager ) {
+ $elements_manager->add_category(
+ 'user-frontend',
+ [
+ 'title' => __( 'User Frontend', 'wp-user-frontend' ),
+ 'icon' => 'eicon-form-horizontal',
+ ]
+ );
+ }
+
+ /**
+ * Register Elementor Widgets
+ *
+ * @param \Elementor\Widgets_Manager $widgets_manager
+ *
+ * @return void
+ */
+ public function register_widgets( $widgets_manager ) {
+ require_once __DIR__ . '/Widget.php';
+ require_once __DIR__ . '/Subscription_Plans_Widget.php';
+
+ $widgets_manager->register( new Widget() );
+ $widgets_manager->register( new Subscription_Plans_Widget() );
+ }
+}
diff --git a/includes/Integrations/Elementor/Subscription_Plans_Widget.php b/includes/Integrations/Elementor/Subscription_Plans_Widget.php
new file mode 100644
index 000000000..52f5b7f94
--- /dev/null
+++ b/includes/Integrations/Elementor/Subscription_Plans_Widget.php
@@ -0,0 +1,1709 @@
+register_content_controls();
+
+ // Style Controls
+ $this->register_container_style_controls();
+ $this->register_plan_name_style_controls();
+ $this->register_plan_description_style_controls();
+ $this->register_price_style_controls();
+ $this->register_trial_description_style_controls();
+ $this->register_features_list_style_controls();
+ $this->register_see_more_style_controls();
+ $this->register_button_style_controls();
+ }
+
+ /**
+ * Register content controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_content_controls() {
+ $this->start_controls_section(
+ 'section_content',
+ [
+ 'label' => __( 'Content', 'wp-user-frontend' ),
+ ]
+ );
+
+ $this->add_control(
+ 'plans_per_row',
+ [
+ 'label' => __( 'Plans Per Row', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => '3',
+ 'options' => [
+ '1' => __( '1', 'wp-user-frontend' ),
+ '2' => __( '2', 'wp-user-frontend' ),
+ '3' => __( '3', 'wp-user-frontend' ),
+ '4' => __( '4', 'wp-user-frontend' ),
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'order_by',
+ [
+ 'label' => __( 'Order By', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => 'custom',
+ 'description' => __( 'Choose how to sort the subscription plans. Custom Order uses the sort order set in each plan\'s settings.', 'wp-user-frontend' ),
+ 'options' => [
+ 'custom' => __( 'Custom Order', 'wp-user-frontend' ),
+ 'id' => __( 'Plan ID', 'wp-user-frontend' ),
+ 'price_asc' => __( 'Price (Low to High)', 'wp-user-frontend' ),
+ 'price_desc' => __( 'Price (High to Low)', 'wp-user-frontend' ),
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register container style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_container_style_controls() {
+ $this->start_controls_section(
+ 'section_container_style',
+ [
+ 'label' => __( 'Subscription Cards', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'container_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-card' => 'background-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'card_border',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-card',
+ 'fields_options' => [
+ 'border' => [
+ 'default' => 'solid',
+ ],
+ 'width' => [
+ 'default' => [
+ 'top' => '1',
+ 'right' => '1',
+ 'bottom' => '1',
+ 'left' => '1',
+ 'isLinked' => true,
+ ],
+ ],
+ 'color' => [
+ 'default' => '#e5e7eb',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'card_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'default' => [
+ 'top' => '12',
+ 'right' => '12',
+ 'bottom' => '12',
+ 'left' => '12',
+ 'isLinked' => true,
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-card' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'card_box_shadow',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-card',
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'card_padding',
+ [
+ 'label' => __( 'Card Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'default' => [
+ 'top' => '24',
+ 'right' => '24',
+ 'bottom' => '24',
+ 'left' => '24',
+ 'isLinked' => true,
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-card' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'card_margin',
+ [
+ 'label' => __( 'Card Margin', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-card' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'cards_gap',
+ [
+ 'label' => __( 'Gap Between Cards', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 100 ] ],
+ 'default' => [
+ 'size' => '20',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-subscription-plans-grid' => 'gap: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register plan name style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_plan_name_style_controls() {
+ $this->start_controls_section(
+ 'section_plan_name_style',
+ [
+ 'label' => __( 'Plan Name', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'plan_name_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#111827',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-plan-name' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'plan_name_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-plan-name',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '24',
+ 'unit' => 'px',
+ ],
+ ],
+ 'font_weight' => [
+ 'default' => '700',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'plan_name_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-plan-name' => 'text-align: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'plan_name_margin_bottom',
+ [
+ 'label' => __( 'Margin Bottom', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ],
+ 'default' => [
+ 'size' => '16',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-plan-name' => 'margin-bottom: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register plan description style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_plan_description_style_controls() {
+ $this->start_controls_section(
+ 'section_plan_description_style',
+ [
+ 'label' => __( 'Plan Description', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'plan_description_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6b7280',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-description' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'plan_description_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-description',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '14',
+ 'unit' => 'px',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'plan_description_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-description' => 'text-align: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'plan_description_margin_bottom',
+ [
+ 'label' => __( 'Margin Bottom', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ],
+ 'default' => [
+ 'size' => '16',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-description' => 'margin-bottom: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register price style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_price_style_controls() {
+ $this->start_controls_section(
+ 'section_price_style',
+ [
+ 'label' => __( 'Price', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'price_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-price-wrapper' => 'text-align: {{VALUE}};',
+ '{{WRAPPER}} .wpuf-sub-price' => 'justify-content: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'price_margin_bottom',
+ [
+ 'label' => __( 'Margin Bottom', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ],
+ 'default' => [
+ 'size' => '20',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-price-wrapper' => 'margin-bottom: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'currency_symbol_size',
+ [
+ 'label' => __( 'Currency Symbol Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em' ],
+ 'range' => [ 'px' => [ 'min' => 8, 'max' => 80 ] ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-currency' => 'font-size: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'currency_color',
+ [
+ 'label' => __( 'Currency Symbol Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6b7280',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-currency' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'billing_amount_heading',
+ [
+ 'label' => __( 'Billing Amount', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::HEADING,
+ 'separator' => 'before',
+ ]
+ );
+
+ $this->add_control(
+ 'price_color',
+ [
+ 'label' => __( 'Price Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#111827',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-price' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'billing_amount_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-amount',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '36',
+ 'unit' => 'px',
+ ],
+ ],
+ 'font_weight' => [
+ 'default' => '700',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'billing_cycle_heading',
+ [
+ 'label' => __( 'Billing Cycle', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::HEADING,
+ 'separator' => 'before',
+ ]
+ );
+
+ $this->add_control(
+ 'billing_cycle_color',
+ [
+ 'label' => __( 'Billing Cycle Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6b7280',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-billing-cycle' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'billing_cycle_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-billing-cycle',
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register trial description style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_trial_description_style_controls() {
+ $this->start_controls_section(
+ 'section_trial_style',
+ [
+ 'label' => __( 'Trial Description', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'trial_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#059669',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-trial-description' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'trial_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-trial-description',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '14',
+ 'unit' => 'px',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'trial_font_size',
+ [
+ 'label' => __( 'Text Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em' ],
+ 'range' => [ 'px' => [ 'min' => 8, 'max' => 50 ] ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-trial-description' => 'font-size: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'trial_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-trial-description' => 'text-align: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register features list style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_features_list_style_controls() {
+ $this->start_controls_section(
+ 'section_features_style',
+ [
+ 'label' => __( 'Features List', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'features_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#4b5563',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-list' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'icon_color',
+ [
+ 'label' => __( 'Icon Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#10b981',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-feature-icon' => 'fill: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'icon_size',
+ [
+ 'label' => __( 'Icon Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 10, 'max' => 50 ] ],
+ 'default' => [
+ 'size' => '20',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-feature-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'features_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-features-list',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '14',
+ 'unit' => 'px',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'features_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-list' => 'text-align: {{VALUE}};',
+ '{{WRAPPER}} .wpuf-sub-feature-item' => 'justify-content: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'features_line_spacing',
+ [
+ 'label' => __( 'Line Spacing', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ],
+ 'default' => [
+ 'size' => '12',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-feature-item' => 'margin-bottom: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'features_margin_bottom',
+ [
+ 'label' => __( 'Margin Bottom', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 50 ] ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-list' => 'margin-bottom: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register see more toggle style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_see_more_style_controls() {
+ $this->start_controls_section(
+ 'section_see_more_style',
+ [
+ 'label' => __( 'See More Toggle', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'see_more_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6366f1',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-toggle' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'see_more_hover_color',
+ [
+ 'label' => __( 'Hover Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-toggle:hover' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'see_more_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-features-toggle',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '13',
+ 'unit' => 'px',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'see_more_align',
+ [
+ 'label' => __( 'Text Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'default' => 'left',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-toggle-wrapper' => 'text-align: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'see_more_margin_top',
+ [
+ 'label' => __( 'Margin Top', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 30 ] ],
+ 'default' => [
+ 'size' => '8',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-features-toggle-wrapper' => 'margin-top: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register button style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_button_style_controls() {
+ $this->start_controls_section(
+ 'section_button_style',
+ [
+ 'label' => __( 'Subscribe Button', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'button_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-button',
+ 'fields_options' => [
+ 'font_size' => [
+ 'default' => [
+ 'size' => '16',
+ 'unit' => 'px',
+ ],
+ ],
+ 'font_weight' => [
+ 'default' => '600',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'button_font_size',
+ [
+ 'label' => __( 'Text Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em', 'rem' ],
+ 'range' => [
+ 'px' => [ 'min' => 8, 'max' => 50 ],
+ 'em' => [ 'min' => 0.5, 'max' => 5 ],
+ 'rem' => [ 'min' => 0.5, 'max' => 5 ],
+ ],
+ 'default' => [
+ 'size' => '1',
+ 'unit' => 'rem',
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button' => 'font-size: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'button_align',
+ [
+ 'label' => __( 'Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-right' ],
+ ],
+ 'default' => 'center',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button-wrapper' => 'text-align: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->start_controls_tabs( 'tabs_button_style' );
+
+ $this->start_controls_tab( 'tab_button_normal', [ 'label' => __( 'Normal', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'button_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'button_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#64748b',
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button' => 'background-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'button_border',
+ 'selector' => '{{WRAPPER}} .wpuf-sub-button',
+ 'fields_options' => [
+ 'border' => [
+ 'default' => 'solid',
+ ],
+ 'width' => [
+ 'default' => [
+ 'top' => '1',
+ 'right' => '1',
+ 'bottom' => '1',
+ 'left' => '1',
+ 'isLinked' => true,
+ ],
+ ],
+ 'color' => [
+ 'default' => 'transparent',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'button_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'default' => [
+ 'top' => '5',
+ 'right' => '5',
+ 'bottom' => '5',
+ 'left' => '5',
+ 'isLinked' => true,
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'button_padding',
+ [
+ 'label' => __( 'Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'default' => [
+ 'top' => '5',
+ 'right' => '20',
+ 'bottom' => '5',
+ 'left' => '20',
+ 'isLinked' => false,
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->start_controls_tab( 'tab_button_hover', [ 'label' => __( 'Hover', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'button_hover_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button:hover' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'button_hover_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button:hover' => 'background-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'button_hover_border_color',
+ [
+ 'label' => __( 'Border Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-sub-button:hover' => 'border-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->end_controls_tabs();
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Retrieve subscription plans based on widget settings
+ *
+ * @since WPUF_SINCE
+ *
+ * @param array $settings Widget settings.
+ * @return array Array of subscription packs
+ */
+ protected function get_subscription_plans( $settings ) {
+ $args = [
+ 'post_type' => 'wpuf_subscription',
+ 'posts_per_page' => -1,
+ 'post_status' => 'publish',
+ ];
+
+ $order_by = isset( $settings['order_by'] ) ? $settings['order_by'] : 'custom';
+
+ switch ( $order_by ) {
+ case 'id':
+ $args['orderby'] = 'ID';
+ $args['order'] = 'ASC';
+ break;
+ case 'price_asc':
+ $args['orderby'] = 'meta_value_num';
+ $args['meta_key'] = '_billing_amount';
+ $args['order'] = 'ASC';
+ break;
+ case 'price_desc':
+ $args['orderby'] = 'meta_value_num';
+ $args['meta_key'] = '_billing_amount';
+ $args['order'] = 'DESC';
+ break;
+ case 'custom':
+ default:
+ $args['meta_key'] = '_sort_order';
+ $args['orderby'] = [ 'meta_value_num' => 'ASC', 'title' => 'ASC' ];
+ break;
+ }
+
+ $packs = get_posts( $args );
+
+ if ( ! empty( $packs ) ) {
+ foreach ( $packs as $key => $post ) {
+ $packs[ $key ]->meta_value = wpuf()->subscription->get_subscription_meta( $post->ID, $post );
+ }
+ }
+
+ return $packs;
+ }
+
+ /**
+ * Get the CSS class for plans per row
+ *
+ * @since WPUF_SINCE
+ *
+ * @param string $plans_per_row Number of plans per row.
+ * @return string CSS class
+ */
+ protected function get_plans_per_row_class( $plans_per_row ) {
+ return 'wpuf-sub-plans-' . $plans_per_row;
+ }
+
+ /**
+ * Render the widget output on the frontend
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function render() {
+ $settings = $this->get_settings_for_display();
+
+ $packs = $this->get_subscription_plans( $settings );
+
+ $is_elementor_editor = $this->is_editor_render();
+
+ // Show empty state in editor if no plans
+ if ( $is_elementor_editor && empty( $packs ) ) {
+ $this->render_empty_state();
+ return;
+ }
+
+ // Show nothing in frontend if no plans
+ if ( ! $is_elementor_editor && empty( $packs ) ) {
+ return;
+ }
+
+ $plans_per_row = isset( $settings['plans_per_row'] ) ? $settings['plans_per_row'] : '3';
+ $grid_class = $this->get_plans_per_row_class( $plans_per_row );
+
+ $this->add_render_attribute(
+ 'wrapper',
+ [
+ 'class' => [ 'wpuf-subscription-plans-wrapper', $grid_class ],
+ ]
+ );
+
+ $user_id = get_current_user_id();
+ $current_pack = wpuf()->subscription->get_user_pack( $user_id );
+ $current_pack_id = isset( $current_pack['pack_id'] ) ? $current_pack['pack_id'] : '';
+ $current_pack_status = isset( $current_pack['status'] ) ? $current_pack['status'] : '';
+
+ echo 'get_render_attribute_string( 'wrapper' ) . '>';
+ echo '
';
+
+ foreach ( $packs as $pack ) :
+ $this->render_plan_card( $pack, $current_pack_id, $current_pack_status );
+ endforeach;
+
+ echo '
';
+ echo '
';
+
+ if ( $is_elementor_editor ) {
+ $this->render_toggle_script();
+ }
+ }
+
+ /**
+ * Render empty state for Elementor editor
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function render_empty_state() {
+ echo '';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
' . esc_html__( 'No subscription plans available.', 'wp-user-frontend' ) . '
';
+ echo '
' . esc_html__( 'Create a subscription plan in WPUF settings.', 'wp-user-frontend' ) . '
';
+ echo '
';
+ echo '
';
+ }
+
+ /**
+ * Render a single plan card
+ *
+ * @since WPUF_SINCE
+ *
+ * @param \WP_Post $pack The subscription plan post object.
+ * @param string $current_pack_id Current active pack ID.
+ * @param string $current_pack_status Current pack status.
+ * @return void
+ */
+ protected function render_plan_card( $pack, $current_pack_id, $current_pack_status ) {
+ $settings = $this->get_settings_for_display();
+ $billing_amount = isset( $pack->meta_value['billing_amount'] ) ? floatval( $pack->meta_value['billing_amount'] ) : 0;
+ $recurring_pay = wpuf_is_checkbox_or_toggle_on( $pack->meta_value['recurring_pay'] ?? '' );
+ $trial_status = wpuf_is_checkbox_or_toggle_on( $pack->meta_value['trial_status'] ?? '' );
+ $billing_cycle_number = isset( $pack->meta_value['billing_cycle_number'] ) ? $pack->meta_value['billing_cycle_number'] : 1;
+ $cycle_period = isset( $pack->meta_value['cycle_period'] ) ? $pack->meta_value['cycle_period'] : 'month';
+ $trial_duration = isset( $pack->meta_value['trial_duration'] ) ? $pack->meta_value['trial_duration'] : 0;
+ $trial_duration_type = isset( $pack->meta_value['trial_duration_type'] ) ? $pack->meta_value['trial_duration_type'] : 'day';
+
+ $this->add_render_attribute(
+ 'card-' . $pack->ID,
+ [
+ 'class' => [ 'wpuf-sub-card', 'wpuf-sub-card-' . $pack->ID ],
+ ]
+ );
+
+ echo 'get_render_attribute_string( 'card-' . $pack->ID ) . '>';
+
+ // Plan Name
+ echo '
' . esc_html( $pack->post_title ) . '
';
+
+ // Description
+ if ( ! empty( $pack->post_content ) ) {
+ echo '
' . wp_kses_post( wpautop( $pack->post_content ) ) . '
';
+ }
+
+ // Price Section
+ echo '
';
+ if ( $billing_amount > 0 ) {
+ $currency_symbol = wpuf_get_currency( 'symbol' );
+ $amount_formatted = number_format( $billing_amount, 2, '.', '' );
+
+ echo '
';
+ echo '' . esc_html( $currency_symbol ) . '';
+ echo '' . esc_html( $amount_formatted ) . '';
+
+ if ( $recurring_pay ) {
+ $cycle_label = wpuf()->subscription->get_cycle_label( $cycle_period, $billing_cycle_number );
+ $billing_text = sprintf( __( 'Every %s %s', 'wp-user-frontend' ), $billing_cycle_number, $cycle_label );
+ echo '' . esc_html( $billing_text ) . '';
+ } else {
+ echo '' . esc_html__( 'One time payment', 'wp-user-frontend' ) . '';
+ }
+ echo '
';
+ } else {
+ echo '
' . esc_html__( 'Free', 'wp-user-frontend' ) . '
';
+ }
+ echo '
';
+
+ // Trial Description
+ if ( $billing_amount > 0 && $recurring_pay && $trial_status && $trial_duration > 0 ) {
+ $duration = _n( $trial_duration_type, $trial_duration_type . 's', $trial_duration, 'wp-user-frontend' );
+ $trial_text = sprintf( __( 'Trial available for first %1$s %2$s', 'wp-user-frontend' ), $trial_duration, $duration );
+ echo '
' . esc_html( $trial_text ) . '
';
+ }
+
+ // Button
+ $this->render_button( $pack, $current_pack_id, $current_pack_status, $billing_amount );
+
+ // Features List
+ $this->render_features_list( $pack );
+
+ echo '
';
+ }
+
+ /**
+ * Render the subscribe button
+ *
+ * @since WPUF_SINCE
+ *
+ * @param \WP_Post $pack The subscription plan post object.
+ * @param string $current_pack_id Current active pack ID.
+ * @param string $current_pack_status Current pack status.
+ * @param float $billing_amount The billing amount.
+ * @return void
+ */
+ protected function render_button( $pack, $current_pack_id, $current_pack_status, $billing_amount ) {
+ $user_id = get_current_user_id();
+
+ $is_completed = ( $current_pack_id == $pack->ID && 'completed' === $current_pack_status );
+
+ // Get button labels from WPUF settings
+ if ( ! is_user_logged_in() ) {
+ $button_text = wpuf_get_option( 'logged_out_label', 'wpuf_subscription_settings', '' );
+ $button_text = $button_text ? $button_text : __( 'Sign Up', 'wp-user-frontend' );
+ } elseif ( $billing_amount === 0.0 || $billing_amount === '0.00' ) {
+ $button_text = wpuf_get_option( 'free_label', 'wpuf_subscription_settings', '' );
+ $button_text = $button_text ? $button_text : __( 'Free', 'wp-user-frontend' );
+ } else {
+ $button_text = wpuf_get_option( 'logged_in_label', 'wpuf_subscription_settings', '' );
+ $button_text = $button_text ? $button_text : __( 'Buy Now', 'wp-user-frontend' );
+ }
+
+ // Build button URL
+ if ( ! is_user_logged_in() ) {
+ $query_args = [
+ 'action' => 'register',
+ 'type' => 'wpuf_sub',
+ 'pack_id' => $pack->ID,
+ ];
+ $button_url = wp_registration_url();
+ } else {
+ $query_args = [
+ 'action' => 'wpuf_pay',
+ 'type' => 'pack',
+ 'pack_id' => $pack->ID,
+ ];
+ $button_url = get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
+ }
+
+ $button_url = add_query_arg( $query_args, $button_url );
+
+ $this->add_render_attribute(
+ 'button-' . $pack->ID,
+ [
+ 'class' => [ 'wpuf-sub-button', 'wpuf-sub-button-' . $pack->ID ],
+ 'href' => esc_url( $button_url ),
+ ]
+ );
+
+ if ( $is_completed ) {
+ $this->add_render_attribute( 'button-' . $pack->ID, 'href', 'javascript:void(0)' );
+ $this->add_render_attribute( 'button-' . $pack->ID, 'class', 'wpuf-sub-button-disabled' );
+ }
+
+ echo '';
+ }
+
+ /**
+ * Render the features list for a plan
+ *
+ * @since WPUF_SINCE
+ *
+ * @param \WP_Post $pack The subscription plan post object.
+ * @return void
+ */
+ protected function render_features_list( $pack ) {
+ $features_list = [];
+
+ // Check if custom features are set
+ if ( isset( $pack->meta_value['features'] ) && is_array( $pack->meta_value['features'] ) && ! empty( $pack->meta_value['features'] ) ) {
+ foreach ( $pack->meta_value['features'] as $feature ) {
+ $features_list[] = esc_html( $feature );
+ }
+ } else {
+ // Build features from subscription settings
+ $post_type_limits = isset( $pack->meta_value['_post_type_name'] ) ? maybe_unserialize( $pack->meta_value['_post_type_name'] ) : [];
+ $additional_cpt = isset( $pack->meta_value['additional_cpt_options'] ) ? maybe_unserialize( $pack->meta_value['additional_cpt_options'] ) : [];
+ $all_limits = array_merge( (array) $post_type_limits, (array) $additional_cpt );
+
+ // Posts limit
+ if ( isset( $all_limits['post'] ) && '0' !== $all_limits['post'] ) {
+ if ( '-1' === $all_limits['post'] ) {
+ $features_list[] = __( 'Unlimited posts', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d posts allowed', 'wp-user-frontend' ), intval( $all_limits['post'] ) );
+ }
+ }
+
+ // Pages limit
+ if ( isset( $all_limits['page'] ) && '0' !== $all_limits['page'] ) {
+ if ( '-1' === $all_limits['page'] ) {
+ $features_list[] = __( 'Unlimited pages', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d pages allowed', 'wp-user-frontend' ), intval( $all_limits['page'] ) );
+ }
+ }
+
+ // User Requests limit
+ if ( isset( $all_limits['user_request'] ) && '0' !== $all_limits['user_request'] ) {
+ if ( '-1' === $all_limits['user_request'] ) {
+ $features_list[] = __( 'Unlimited user requests', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d user requests allowed', 'wp-user-frontend' ), intval( $all_limits['user_request'] ) );
+ }
+ }
+
+ // WooCommerce Products limit
+ if ( isset( $all_limits['product'] ) && '0' !== $all_limits['product'] ) {
+ if ( '-1' === $all_limits['product'] ) {
+ $features_list[] = __( 'Unlimited products', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d products allowed', 'wp-user-frontend' ), intval( $all_limits['product'] ) );
+ }
+ }
+
+ // Reusable Blocks limit
+ if ( isset( $all_limits['wp_block'] ) && '0' !== $all_limits['wp_block'] ) {
+ if ( '-1' === $all_limits['wp_block'] ) {
+ $features_list[] = __( 'Unlimited reusable blocks', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d reusable blocks allowed', 'wp-user-frontend' ), intval( $all_limits['wp_block'] ) );
+ }
+ }
+
+ // Templates limit
+ if ( isset( $all_limits['wp_template'] ) && '0' !== $all_limits['wp_template'] ) {
+ if ( '-1' === $all_limits['wp_template'] ) {
+ $features_list[] = __( 'Unlimited templates', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d templates allowed', 'wp-user-frontend' ), intval( $all_limits['wp_template'] ) );
+ }
+ }
+
+ // Template Parts limit
+ if ( isset( $all_limits['wp_template_part'] ) && '0' !== $all_limits['wp_template_part'] ) {
+ if ( '-1' === $all_limits['wp_template_part'] ) {
+ $features_list[] = __( 'Unlimited template parts', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d template parts allowed', 'wp-user-frontend' ), intval( $all_limits['wp_template_part'] ) );
+ }
+ }
+
+ // Navigation Menus limit
+ if ( isset( $all_limits['wp_navigation'] ) && '0' !== $all_limits['wp_navigation'] ) {
+ if ( '-1' === $all_limits['wp_navigation'] ) {
+ $features_list[] = __( 'Unlimited navigation menus', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d navigation menus allowed', 'wp-user-frontend' ), intval( $all_limits['wp_navigation'] ) );
+ }
+ }
+
+ // Global Styles limit
+ if ( isset( $all_limits['wp_global_styles'] ) && '0' !== $all_limits['wp_global_styles'] ) {
+ if ( '-1' === $all_limits['wp_global_styles'] ) {
+ $features_list[] = __( 'Unlimited global styles', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d global styles allowed', 'wp-user-frontend' ), intval( $all_limits['wp_global_styles'] ) );
+ }
+ }
+
+ // Font Families limit
+ if ( isset( $all_limits['wp_font_family'] ) && '0' !== $all_limits['wp_font_family'] ) {
+ if ( '-1' === $all_limits['wp_font_family'] ) {
+ $features_list[] = __( 'Unlimited font families', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d font families allowed', 'wp-user-frontend' ), intval( $all_limits['wp_font_family'] ) );
+ }
+ }
+
+ // Font Faces limit
+ if ( isset( $all_limits['wp_font_face'] ) && '0' !== $all_limits['wp_font_face'] ) {
+ if ( '-1' === $all_limits['wp_font_face'] ) {
+ $features_list[] = __( 'Unlimited font faces', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d font faces allowed', 'wp-user-frontend' ), intval( $all_limits['wp_font_face'] ) );
+ }
+ }
+
+ // Product Variations limit
+ if ( isset( $all_limits['product_variation'] ) && '0' !== $all_limits['product_variation'] ) {
+ if ( '-1' === $all_limits['product_variation'] ) {
+ $features_list[] = __( 'Unlimited product variations', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d product variations allowed', 'wp-user-frontend' ), intval( $all_limits['product_variation'] ) );
+ }
+ }
+
+ // Shop Orders limit
+ if ( isset( $all_limits['shop_order'] ) && '0' !== $all_limits['shop_order'] ) {
+ if ( '-1' === $all_limits['shop_order'] ) {
+ $features_list[] = __( 'Unlimited shop orders', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d shop orders allowed', 'wp-user-frontend' ), intval( $all_limits['shop_order'] ) );
+ }
+ }
+
+ // Shop Refunds limit
+ if ( isset( $all_limits['shop_order_refund'] ) && '0' !== $all_limits['shop_order_refund'] ) {
+ if ( '-1' === $all_limits['shop_order_refund'] ) {
+ $features_list[] = __( 'Unlimited shop refunds', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d shop refunds allowed', 'wp-user-frontend' ), intval( $all_limits['shop_order_refund'] ) );
+ }
+ }
+
+ // Shop Coupons limit
+ if ( isset( $all_limits['shop_coupon'] ) && '0' !== $all_limits['shop_coupon'] ) {
+ if ( '-1' === $all_limits['shop_coupon'] ) {
+ $features_list[] = __( 'Unlimited shop coupons', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d shop coupons allowed', 'wp-user-frontend' ), intval( $all_limits['shop_coupon'] ) );
+ }
+ }
+
+ // Featured items limit
+ if ( isset( $pack->meta_value['_total_feature_item'] ) && '0' !== $pack->meta_value['_total_feature_item'] ) {
+ if ( '-1' === $pack->meta_value['_total_feature_item'] ) {
+ $features_list[] = __( 'Unlimited featured items', 'wp-user-frontend' );
+ } else {
+ $features_list[] = sprintf( __( '%d featured items', 'wp-user-frontend' ), intval( $pack->meta_value['_total_feature_item'] ) );
+ }
+ }
+
+ // Post expiration
+ if ( isset( $pack->meta_value['_enable_post_expiration'] ) && 'yes' === $pack->meta_value['_enable_post_expiration'] ) {
+ $expiry_period = isset( $pack->meta_value['_post_expiration_number'] ) ? intval( $pack->meta_value['_post_expiration_number'] ) : 0;
+ $expiry_type = isset( $pack->meta_value['_post_expiration_period'] ) ? $pack->meta_value['_post_expiration_period'] : 'day';
+
+ if ( $expiry_period > 0 ) {
+ $features_list[] = sprintf( __( 'Posts expire after %d %s', 'wp-user-frontend' ), $expiry_period, $expiry_type . ( $expiry_period > 1 ? 's' : '' ) );
+ } else {
+ $features_list[] = __( 'Post expiration enabled', 'wp-user-frontend' );
+ }
+ }
+
+ // Recurring payment
+ if ( wpuf_is_checkbox_or_toggle_on( $pack->meta_value['recurring_pay'] ?? '' ) ) {
+ $features_list[] = __( 'Recurring subscription', 'wp-user-frontend' );
+ }
+
+ // Trial period
+ if ( wpuf_is_checkbox_or_toggle_on( $pack->meta_value['trial_status'] ?? '' ) ) {
+ $trial_duration = isset( $pack->meta_value['trial_duration'] ) ? intval( $pack->meta_value['trial_duration'] ) : 0;
+ $trial_type = isset( $pack->meta_value['trial_duration_type'] ) ? $pack->meta_value['trial_duration_type'] : 'day';
+
+ if ( $trial_duration > 0 ) {
+ $features_list[] = sprintf( __( '%d %s free trial', 'wp-user-frontend' ), $trial_duration, $trial_type . ( $trial_duration > 1 ? 's' : '' ) );
+ } else {
+ $features_list[] = __( 'Free trial available', 'wp-user-frontend' );
+ }
+ }
+
+ // Mail notification on expiry
+ if ( isset( $pack->meta_value['_enable_mail_after_expired'] ) && 'yes' === $pack->meta_value['_enable_mail_after_expired'] ) {
+ $features_list[] = __( 'Email notifications on post expiry', 'wp-user-frontend' );
+ }
+
+ // If no features found, show a basic feature
+ if ( empty( $features_list ) ) {
+ $features_list[] = __( 'Full website access', 'wp-user-frontend' );
+ }
+ }
+
+ // Render features list
+ if ( ! empty( $features_list ) ) {
+ $features_count = count( $features_list );
+ $initial_display_count = 5;
+ $pack_id = $pack->ID;
+
+ echo '';
+
+ foreach ( $features_list as $index => $feature ) {
+ $is_hidden = $index >= $initial_display_count ? ' wpuf-sub-feature-hidden' : '';
+
+ echo '- ';
+ echo '';
+ echo '' . esc_html( $feature ) . '';
+ echo '
';
+ }
+
+ echo '
';
+
+ // Show See More/Less button if features exceed initial display count
+ if ( $features_count > $initial_display_count ) {
+ $hidden_count = $features_count - $initial_display_count;
+
+ echo '';
+ echo '';
+ echo '';
+ echo '
';
+ }
+ }
+ }
+
+ /**
+ * Render toggle script for expandable features
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function render_toggle_script() {
+ ?>
+
+ editor ) && \Elementor\Plugin::$instance->editor->is_edit_mode() )
+ || ( isset( \Elementor\Plugin::$instance->preview ) && \Elementor\Plugin::$instance->preview->is_preview_mode() )
+ );
+ }
+
+ /**
+ * Render the widget output in the editor
+ *
+ * When empty, Elementor will fall back to using the render() method for
+ * both frontend and editor preview.
+ *
+ * @since WPUF_SINCE
+ *
+ * @access protected
+ */
+ protected function content_template() {}
+}
diff --git a/includes/Integrations/Elementor/Widget.php b/includes/Integrations/Elementor/Widget.php
new file mode 100644
index 000000000..b034f4c19
--- /dev/null
+++ b/includes/Integrations/Elementor/Widget.php
@@ -0,0 +1,1280 @@
+start_controls_section(
+ 'section_content',
+ [
+ 'label' => __( 'Content', 'wp-user-frontend' ),
+ ]
+ );
+
+ $this->add_control(
+ 'form_id',
+ [
+ 'label' => __( 'Select Form', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => '',
+ 'options' => $this->get_wpuf_forms(),
+ ]
+ );
+
+ $this->end_controls_section();
+
+ // Style Tab
+ $this->register_container_style_controls();
+ $this->register_label_style_controls();
+ $this->register_input_style_controls();
+ $this->register_placeholder_style_controls();
+ $this->register_radio_checkbox_style_controls();
+ $this->register_upload_button_style_controls();
+ $this->register_submit_button_style_controls();
+
+ /**
+ * Fires after the widget has registered its style controls.
+ *
+ * Use this to add additional style sections (e.g. for Pro features like multistep).
+ *
+ * @since WPUF_SINCE
+ *
+ * @param \Elementor\Widget_Base $this The widget instance.
+ */
+ do_action( 'wpuf_elementor_widget_register_style_controls', $this );
+ }
+
+ /**
+ * Retrieve all published WPUF forms
+ *
+ * @since WPUF_SINCE
+ *
+ * @return array Array of forms formatted as select options
+ */
+ protected function get_wpuf_forms() {
+ $forms = get_posts( [
+ 'post_type' => 'wpuf_forms',
+ 'posts_per_page' => -1,
+ 'post_status' => 'publish',
+ ] );
+
+ $options = [ '' => __( 'Select a Form', 'wp-user-frontend' ) ];
+
+ if ( ! empty( $forms ) ) {
+ foreach ( $forms as $form ) {
+ $options[ $form->ID ] = $form->post_title;
+ }
+ }
+
+ /**
+ * Filters the form options shown in the widget's form dropdown.
+ *
+ * @since WPUF_SINCE
+ *
+ * @param array $options Associative array of form_id => form_title.
+ * @param \Elementor\Widget_Base $this The widget instance.
+ */
+ return apply_filters( 'wpuf_elementor_form_options', $options, $this );
+ }
+
+ /**
+ * Register container style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_container_style_controls() {
+ $this->start_controls_section(
+ 'section_container_style',
+ [
+ 'label' => __( 'Form Container', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Background::get_type(),
+ [
+ 'name' => 'container_background',
+ 'label' => __( 'Background', 'wp-user-frontend' ),
+ 'types' => [ 'classic', 'gradient' ],
+ 'selector' => '{{WRAPPER}} .wpuf-elementor-widget-wrapper',
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'container_max_width',
+ [
+ 'label' => __( 'Max Width', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'range' => [
+ 'px' => [ 'min' => 10, 'max' => 1500 ],
+ 'em' => [ 'min' => 1, 'max' => 80 ],
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-elementor-widget-wrapper' => 'width: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'container_alignment',
+ [
+ 'label' => __( 'Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'default' => [
+ 'title' => __( 'Default', 'wp-user-frontend' ),
+ 'icon' => 'eicon-ban',
+ ],
+ 'left' => [
+ 'title' => __( 'Left', 'wp-user-frontend' ),
+ 'icon' => 'eicon-h-align-left',
+ ],
+ 'center' => [
+ 'title' => __( 'Center', 'wp-user-frontend' ),
+ 'icon' => 'eicon-h-align-center',
+ ],
+ 'right' => [
+ 'title' => __( 'Right', 'wp-user-frontend' ),
+ 'icon' => 'eicon-h-align-right',
+ ],
+ ],
+ 'default' => 'default',
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'container_padding',
+ [
+ 'label' => __( 'Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-elementor-widget-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'container_margin',
+ [
+ 'label' => __( 'Margin', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-elementor-widget-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'container_border',
+ 'selector' => '{{WRAPPER}} .wpuf-elementor-widget-wrapper',
+ ]
+ );
+
+ $this->add_control(
+ 'container_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-elementor-widget-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'container_box_shadow',
+ 'selector' => '{{WRAPPER}} .wpuf-elementor-widget-wrapper',
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register label style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_label_style_controls() {
+ $this->start_controls_section(
+ 'section_label_style',
+ [
+ 'label' => __( 'Labels', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'label_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form .wpuf-label' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'label_typography',
+ 'selector' => '{{WRAPPER}} .wpuf-form .wpuf-label',
+ ]
+ );
+
+ $this->add_control(
+ 'label_asterisk_color',
+ [
+ 'label' => __( 'Asterisk Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form .wpuf-label .required' => 'color: {{VALUE}};',
+ ],
+ 'separator' => 'before',
+ ]
+ );
+
+ $this->add_control(
+ 'label_asterisk_size',
+ [
+ 'label' => __( 'Asterisk Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'range' => [
+ 'px' => [ 'min' => 0, 'max' => 30, 'step' => 1 ],
+ '%' => [ 'min' => 0, 'max' => 30, 'step' => 1 ],
+ ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form .wpuf-label .required' => 'font-size: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register input field style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_input_style_controls() {
+ $input_selector = '{{WRAPPER}} .wpuf-form input[type="text"], {{WRAPPER}} .wpuf-form input[type="email"], {{WRAPPER}} .wpuf-form input[type="url"], {{WRAPPER}} .wpuf-form input[type="password"], {{WRAPPER}} .wpuf-form input[type="number"], {{WRAPPER}} .wpuf-form textarea, {{WRAPPER}} .wpuf-form select';
+
+ $this->start_controls_section(
+ 'section_input_style',
+ [
+ 'label' => __( 'Input & Textarea', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'input_alignment',
+ [
+ 'label' => __( 'Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-text-align-right' ],
+ ],
+ 'selectors' => [ $input_selector => 'text-align: {{VALUE}};' ],
+ ]
+ );
+
+ $this->start_controls_tabs( 'tabs_input_style' );
+
+ $this->start_controls_tab( 'tab_input_normal', [ 'label' => __( 'Normal', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'input_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [ $input_selector => 'background-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'input_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [ $input_selector => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [ 'name' => 'input_typography', 'selector' => $input_selector ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [ 'name' => 'input_border', 'selector' => $input_selector ]
+ );
+
+ $this->add_control(
+ 'input_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'selectors' => [ $input_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'input_padding',
+ [
+ 'label' => __( 'Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'selectors' => [ $input_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'input_box_shadow',
+ 'selector' => $input_selector,
+ 'separator' => 'before',
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->start_controls_tab( 'tab_input_focus', [ 'label' => __( 'Focus', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'input_focus_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form input[type="text"]:focus, {{WRAPPER}} .wpuf-form input[type="email"]:focus, {{WRAPPER}} .wpuf-form input[type="url"]:focus, {{WRAPPER}} .wpuf-form input[type="password"]:focus, {{WRAPPER}} .wpuf-form input[type="number"]:focus, {{WRAPPER}} .wpuf-form textarea:focus, {{WRAPPER}} .wpuf-form select:focus' => 'background-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'input_focus_border',
+ 'selector' => '{{WRAPPER}} .wpuf-form input[type="text"]:focus, {{WRAPPER}} .wpuf-form input[type="email"]:focus, {{WRAPPER}} .wpuf-form input[type="url"]:focus, {{WRAPPER}} .wpuf-form input[type="password"]:focus, {{WRAPPER}} .wpuf-form input[type="number"]:focus, {{WRAPPER}} .wpuf-form textarea:focus, {{WRAPPER}} .wpuf-form select:focus',
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'input_focus_box_shadow',
+ 'selector' => '{{WRAPPER}} .wpuf-form input[type="text"]:focus, {{WRAPPER}} .wpuf-form input[type="email"]:focus, {{WRAPPER}} .wpuf-form input[type="url"]:focus, {{WRAPPER}} .wpuf-form input[type="password"]:focus, {{WRAPPER}} .wpuf-form input[type="number"]:focus, {{WRAPPER}} .wpuf-form textarea:focus, {{WRAPPER}} .wpuf-form select:focus',
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->end_controls_tabs();
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register placeholder style controls.
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_placeholder_style_controls() {
+ $this->start_controls_section(
+ 'section_placeholder_style',
+ [
+ 'label' => __( 'Placeholder', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $placeholder_selector = '{{WRAPPER}} .wpuf-form input::placeholder, {{WRAPPER}} .wpuf-form textarea::placeholder, {{WRAPPER}} .wpuf-form input::-webkit-input-placeholder, {{WRAPPER}} .wpuf-form textarea::-webkit-input-placeholder, {{WRAPPER}} .wpuf-form input::-moz-placeholder, {{WRAPPER}} .wpuf-form textarea::-moz-placeholder, {{WRAPPER}} .wpuf-form input:-ms-input-placeholder, {{WRAPPER}} .wpuf-form textarea:-ms-input-placeholder';
+
+ $this->add_control(
+ 'placeholder_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [ $placeholder_selector => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register radio and checkbox style controls.
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_radio_checkbox_style_controls() {
+ $this->start_controls_section(
+ 'section_radio_checkbox_style',
+ [
+ 'label' => __( 'Radio & Checkbox', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'radio_checkbox_size',
+ [
+ 'label' => __( 'Size', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 80, 'step' => 1 ] ],
+ 'default' => [ 'size' => 18, 'unit' => 'px' ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form input[type="radio"], {{WRAPPER}} .wpuf-form input[type="checkbox"]' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'radio_checkbox_spacing',
+ [
+ 'label' => __( 'Spacing', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', 'em' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 30, 'step' => 1 ] ],
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form input[type="radio"], {{WRAPPER}} .wpuf-form input[type="checkbox"]' => 'margin-right: {{SIZE}}{{UNIT}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'radio_checkbox_selector_color',
+ [
+ 'label' => __( 'Selector Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form input[type="radio"], {{WRAPPER}} .wpuf-form input[type="checkbox"]' => 'accent-color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'radio_checkbox_options_text_color',
+ [
+ 'label' => __( 'Options Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [
+ '{{WRAPPER}} .wpuf-form .wpuf-radio-block, {{WRAPPER}} .wpuf-form .wpuf-checkbox-block, {{WRAPPER}} .wpuf-form .wpuf-radio-inline, {{WRAPPER}} .wpuf-form .wpuf-checkbox-inline' => 'color: {{VALUE}};',
+ ],
+ ]
+ );
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register upload button style controls
+ *
+ * Styles the file/image upload buttons (e.g. "Select File", "Select Image") within WPUF forms.
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_upload_button_style_controls() {
+ $btn_selector = '{{WRAPPER}} .wpuf-form .file-selector';
+ $align_selector = '{{WRAPPER}} .wpuf-form .wpuf-attachment-upload-filelist';
+
+ $this->start_controls_section(
+ 'section_upload_button_style',
+ [
+ 'label' => __( 'Upload Button', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'upload_button_width_type',
+ [
+ 'label' => __( 'Width', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => 'custom',
+ 'options' => [
+ 'full-width' => __( 'Full Width', 'wp-user-frontend' ),
+ 'custom' => __( 'Custom', 'wp-user-frontend' ),
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'upload_button_align',
+ [
+ 'label' => __( 'Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'default' => 'left',
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-right' ],
+ ],
+ 'selectors' => [ $align_selector => 'text-align: {{VALUE}};' ],
+ 'condition' => [ 'upload_button_width_type' => 'custom' ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'upload_button_width',
+ [
+ 'label' => __( 'Width', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', '%' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 1200, 'step' => 1 ] ],
+ 'selectors' => [ $btn_selector => 'width: {{SIZE}}{{UNIT}};' ],
+ 'condition' => [ 'upload_button_width_type' => 'custom' ],
+ ]
+ );
+
+ $this->start_controls_tabs( 'tabs_upload_button_style' );
+
+ $this->start_controls_tab( 'tab_upload_button_normal', [ 'label' => __( 'Normal', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'upload_button_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6b7280',
+ 'selectors' => [ $btn_selector => 'background-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'upload_button_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [ $btn_selector => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'upload_button_typography',
+ 'selector' => $btn_selector,
+ 'fields_options' => [
+ 'font_weight' => [
+ 'default' => '500',
+ ],
+ 'font_size' => [
+ 'default' => [
+ 'unit' => 'px',
+ 'size' => '16',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'upload_button_border',
+ 'selector' => $btn_selector,
+ 'fields_options' => [
+ 'border' => [
+ 'default' => 'solid',
+ ],
+ 'width' => [
+ 'default' => [
+ 'top' => '0',
+ 'right' => '0',
+ 'bottom' => '0',
+ 'left' => '0',
+ ],
+ ],
+ 'color' => [
+ 'default' => 'transparent',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'upload_button_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'default' => [
+ 'top' => '6',
+ 'right' => '6',
+ 'bottom' => '6',
+ 'left' => '6',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [ $btn_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'upload_button_padding',
+ [
+ 'label' => __( 'Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'default' => [
+ 'top' => '12',
+ 'right' => '24',
+ 'bottom' => '12',
+ 'left' => '24',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [ $btn_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'upload_button_box_shadow',
+ 'selector' => $btn_selector,
+ 'separator' => 'before',
+ 'fields_options' => [
+ 'box_shadow_type' => [
+ 'default' => 'yes',
+ ],
+ 'box_shadow' => [
+ 'default' => [
+ 'horizontal' => 0,
+ 'vertical' => 1,
+ 'blur' => 3,
+ 'spread' => 0,
+ 'color' => 'rgba(0, 0, 0, 0.1)',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->start_controls_tab( 'tab_upload_button_hover', [ 'label' => __( 'Hover', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'upload_button_hover_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#4b5563',
+ 'selectors' => [ $btn_selector . ':hover' => 'background-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'upload_button_hover_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [ $btn_selector . ':hover' => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'upload_button_hover_border_color',
+ [
+ 'label' => __( 'Border Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [ $btn_selector . ':hover' => 'border-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->end_controls_tabs();
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Register submit button style controls
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function register_submit_button_style_controls() {
+ $btn_selector = '{{WRAPPER}} .wpuf-form .wpuf-submit-button';
+
+ $this->start_controls_section(
+ 'section_submit_button_style',
+ [
+ 'label' => __( 'Submit Button', 'wp-user-frontend' ),
+ 'tab' => Controls_Manager::TAB_STYLE,
+ ]
+ );
+
+ $this->add_control(
+ 'submit_button_width_type',
+ [
+ 'label' => __( 'Width', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => 'custom',
+ 'options' => [
+ 'full-width' => __( 'Full Width', 'wp-user-frontend' ),
+ 'custom' => __( 'Custom', 'wp-user-frontend' ),
+ ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'submit_button_align',
+ [
+ 'label' => __( 'Alignment', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::CHOOSE,
+ 'default' => 'left',
+ 'options' => [
+ 'left' => [ 'title' => __( 'Left', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-left' ],
+ 'center' => [ 'title' => __( 'Center', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-center' ],
+ 'right' => [ 'title' => __( 'Right', 'wp-user-frontend' ), 'icon' => 'eicon-h-align-right' ],
+ ],
+ 'selectors' => [ '{{WRAPPER}} .wpuf-form .wpuf-submit' => 'text-align: {{VALUE}};' ],
+ 'condition' => [ 'submit_button_width_type' => 'custom' ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'submit_button_width',
+ [
+ 'label' => __( 'Width', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::SLIDER,
+ 'size_units' => [ 'px', '%' ],
+ 'range' => [ 'px' => [ 'min' => 0, 'max' => 1200, 'step' => 1 ] ],
+ 'selectors' => [ $btn_selector => 'width: {{SIZE}}{{UNIT}};' ],
+ 'condition' => [ 'submit_button_width_type' => 'custom' ],
+ ]
+ );
+
+ $this->start_controls_tabs( 'tabs_submit_button_style' );
+
+ $this->start_controls_tab( 'tab_submit_button_normal', [ 'label' => __( 'Normal', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'submit_button_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#6b7280',
+ 'selectors' => [ $btn_selector => 'background-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'submit_button_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [ $btn_selector => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Typography::get_type(),
+ [
+ 'name' => 'submit_button_typography',
+ 'selector' => $btn_selector,
+ 'fields_options' => [
+ 'font_weight' => [
+ 'default' => '500',
+ ],
+ 'font_size' => [
+ 'default' => [
+ 'unit' => 'px',
+ 'size' => '16',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Border::get_type(),
+ [
+ 'name' => 'submit_button_border',
+ 'selector' => $btn_selector,
+ 'fields_options' => [
+ 'border' => [
+ 'default' => 'solid',
+ ],
+ 'width' => [
+ 'default' => [
+ 'top' => '0',
+ 'right' => '0',
+ 'bottom' => '0',
+ 'left' => '0',
+ ],
+ ],
+ 'color' => [
+ 'default' => 'transparent',
+ ],
+ ],
+ ]
+ );
+
+ $this->add_control(
+ 'submit_button_border_radius',
+ [
+ 'label' => __( 'Border Radius', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', '%' ],
+ 'default' => [
+ 'top' => '6',
+ 'right' => '6',
+ 'bottom' => '6',
+ 'left' => '6',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [ $btn_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_responsive_control(
+ 'submit_button_padding',
+ [
+ 'label' => __( 'Padding', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::DIMENSIONS,
+ 'size_units' => [ 'px', 'em', '%' ],
+ 'default' => [
+ 'top' => '12',
+ 'right' => '24',
+ 'bottom' => '12',
+ 'left' => '24',
+ 'unit' => 'px',
+ ],
+ 'selectors' => [ $btn_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
+ ]
+ );
+
+ $this->add_group_control(
+ Group_Control_Box_Shadow::get_type(),
+ [
+ 'name' => 'submit_button_box_shadow',
+ 'selector' => $btn_selector,
+ 'separator' => 'before',
+ 'fields_options' => [
+ 'box_shadow_type' => [
+ 'default' => 'yes',
+ ],
+ 'box_shadow' => [
+ 'default' => [
+ 'horizontal' => 0,
+ 'vertical' => 1,
+ 'blur' => 3,
+ 'spread' => 0,
+ 'color' => 'rgba(0, 0, 0, 0.1)',
+ ],
+ ],
+ ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->start_controls_tab( 'tab_submit_button_hover', [ 'label' => __( 'Hover', 'wp-user-frontend' ) ] );
+
+ $this->add_control(
+ 'submit_button_hover_bg_color',
+ [
+ 'label' => __( 'Background Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#4b5563',
+ 'selectors' => [ $btn_selector . ':hover' => 'background-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'submit_button_hover_text_color',
+ [
+ 'label' => __( 'Text Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'default' => '#ffffff',
+ 'selectors' => [ $btn_selector . ':hover' => 'color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->add_control(
+ 'submit_button_hover_border_color',
+ [
+ 'label' => __( 'Border Color', 'wp-user-frontend' ),
+ 'type' => Controls_Manager::COLOR,
+ 'selectors' => [ $btn_selector . ':hover' => 'border-color: {{VALUE}};' ],
+ ]
+ );
+
+ $this->end_controls_tab();
+
+ $this->end_controls_tabs();
+
+ $this->end_controls_section();
+ }
+
+ /**
+ * Render the widget output on the frontend
+ *
+ * @since WPUF_SINCE
+ *
+ * @return void
+ */
+ protected function render() {
+ $settings = $this->get_settings_for_display();
+ $form_id = isset( $settings['form_id'] ) ? $settings['form_id'] : null;
+
+ if ( empty( $form_id ) ) {
+ return;
+ }
+
+ $wrapper_classes = [ 'wpuf-elementor-widget-wrapper' ];
+
+ if ( ! empty( $settings['submit_button_width_type'] ) && 'full-width' === $settings['submit_button_width_type'] ) {
+ $wrapper_classes[] = 'wpuf-elementor-submit-full';
+ }
+
+ if ( ! empty( $settings['upload_button_width_type'] ) && 'full-width' === $settings['upload_button_width_type'] ) {
+ $wrapper_classes[] = 'wpuf-elementor-upload-full';
+ }
+
+ /**
+ * Filters the CSS classes applied to the widget wrapper.
+ *
+ * @since WPUF_SINCE
+ *
+ * @param string[] $wrapper_classes Array of class names.
+ * @param array $settings Widget settings.
+ * @param int|null $form_id Selected form ID.
+ */
+ $wrapper_classes = apply_filters( 'wpuf_elementor_widget_wrapper_classes', $wrapper_classes, $settings, $form_id );
+
+ $this->add_render_attribute( 'wrapper', 'class', $wrapper_classes );
+
+ // Set alignment attribute if not default
+ if ( ! empty( $settings['container_alignment'] ) && 'default' !== $settings['container_alignment'] ) {
+ $this->add_render_attribute( 'wrapper', 'data-align', $settings['container_alignment'] );
+ }
+
+ $wrapper_attributes = apply_filters( 'wpuf_elementor_widget_wrapper_attributes', [], $settings, $form_id );
+ foreach ( $wrapper_attributes as $attr_key => $attr_value ) {
+ if ( is_string( $attr_key ) && is_string( $attr_value ) ) {
+ $this->add_render_attribute( 'wrapper', $attr_key, $attr_value );
+ }
+ }
+
+ $shortcode_str = '[wpuf_form id="' . $form_id . '"]';
+ $output = do_shortcode( $shortcode_str );
+
+ $is_elementor = class_exists( '\Elementor\Plugin' ) && (
+ ( isset( \Elementor\Plugin::$instance->editor ) && \Elementor\Plugin::$instance->editor->is_edit_mode() )
+ || ( isset( \Elementor\Plugin::$instance->preview ) && \Elementor\Plugin::$instance->preview->is_preview_mode() )
+ );
+
+ echo 'get_render_attribute_string( 'wrapper' ) ) . '>';
+ echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- shortcode output
+
+ // Initialize TinyMCE in Elementor preview
+ if ( $is_elementor ) {
+ ?>
+
+ ';
+
+ /**
+ * Fires after the widget has rendered its output.
+ *
+ * @since WPUF_SINCE
+ *
+ * @param \Elementor\Widget_Base $this The widget instance.
+ */
+ do_action( 'wpuf_elementor_widget_after_render', $this );
+ }
+
+ /**
+ * Render the widget output in the editor.
+ *
+ * When empty, Elementor will fall back to using the render() method for
+ * both frontend and editor preview.
+ *
+ * @since WPUF_SINCE
+ *
+ * @access protected
+ */
+ protected function content_template() {}
+}
diff --git a/package-lock.json b/package-lock.json
index fb15c9dc9..a88e8919e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1073,7 +1073,6 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.130.tgz",
"integrity": "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==",
"dev": true,
- "peer": true,
"dependencies": {
"undici-types": "~5.26.4"
}
@@ -1976,7 +1975,6 @@
"url": "https://github.com/sponsors/ai"
}
],
- "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -4645,7 +4643,6 @@
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.1.tgz",
"integrity": "sha512-/ABUy3gYWu5iBmrUSRBP97JLpQUm0GgVveDCp6t3yRNIoltIYw7rEj3g5y1o2PGPR2vfTRGa7WC/LZHLTXnEzA==",
"dev": true,
- "peer": true,
"dependencies": {
"dateformat": "~4.6.2",
"eventemitter2": "~0.4.13",
@@ -8496,7 +8493,6 @@
"url": "https://github.com/sponsors/ai"
}
],
- "peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -8666,7 +8662,6 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz",
"integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==",
"dev": true,
- "peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -10071,7 +10066,6 @@
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
"dev": true,
- "peer": true,
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"arg": "^5.0.2",
@@ -10890,7 +10884,6 @@
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
- "peer": true,
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
@@ -10949,7 +10942,6 @@
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.4.tgz",
"integrity": "sha512-3yAj2gkmiY+i7+22A1PWM+kjOVXjU74UPINcTiN7grIVPyFFI0lpGwHlV/4xydDmobaBn7/xmi+YG8HeSlCTcg==",
- "peer": true,
"dependencies": {
"@vue/compiler-dom": "3.5.26",
"@vue/compiler-sfc": "3.5.26",
diff --git a/wpuf-functions.php b/wpuf-functions.php
index cb99e0b63..c10be4b40 100644
--- a/wpuf-functions.php
+++ b/wpuf-functions.php
@@ -1495,6 +1495,11 @@ function wpuf_shortcode_map( $location, $post_id = null, $args = [], $meta_key =