Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
7a73527
Change Email Marketing category name to Marketing
shervElmi Mar 5, 2026
016567a
Update form settings tab icons
shervElmi Mar 5, 2026
34954b4
Update form settings tab icons and add new icon symbols
shervElmi Mar 5, 2026
d0b17f0
Add filter tabs to form actions settings page
shervElmi Mar 5, 2026
573dc41
Set form settings tab icon size to 24px
shervElmi Mar 5, 2026
046e18f
Merge remote-tracking branch 'origin/HEAD' into rock/form-actions-ref…
shervElmi Mar 5, 2026
e815946
Wrap form settings tab names in span with font-medium class
shervElmi Mar 6, 2026
8c4510f
Remove border and padding from form actions addon menu and adjust sea…
shervElmi Mar 6, 2026
3147803
Adjust form settings tab vertical padding to 13px
shervElmi Mar 6, 2026
c518c11
Remove padding and position styles from form settings page inner content
shervElmi Mar 6, 2026
b745283
Add padding and position styles to form settings page inner content a…
shervElmi Mar 6, 2026
193a34e
Remove unused icon_atts variable from form actions icon rendering
shervElmi Mar 10, 2026
39a6f84
Add description field to default action options and align array forma…
shervElmi Mar 10, 2026
13cf165
Add description field to on submit action options and align array for…
shervElmi Mar 10, 2026
633c6e8
Restructure form action icon template to use card-based layout with t…
shervElmi Mar 10, 2026
e8fb9aa
Add description field to all default action options and align array f…
shervElmi Mar 10, 2026
898b52d
Add description field to email action options and align array formatting
shervElmi Mar 10, 2026
92519a7
Remove data-group attributes from action settings tabs and list items…
shervElmi Mar 10, 2026
be671e7
Add description field to Stripe Lite action options and align array f…
shervElmi Mar 10, 2026
0a87589
Remove unused styles for deprecated action list layout and icon circl…
shervElmi Mar 10, 2026
83e34ea
Add frm-ml-auto-force utility class with important flag for forced le…
shervElmi Mar 10, 2026
f917cfc
refactor(admin): add form actions filtering functionality
shervElmi Mar 12, 2026
851067b
refactor(admin): restructure form actions layout for filtering
shervElmi Mar 12, 2026
c66c09c
refactor(admin): prevent class conflicts with filter tabs
shervElmi Mar 12, 2026
3c46e55
feat(admin): add filter functionality to tabs navigator
shervElmi Mar 12, 2026
0d31d38
Add CSS rules for form actions filter functionality with visibility c…
shervElmi Mar 12, 2026
59249eb
Add frm-children-px-sm utility class for small horizontal padding on …
shervElmi Mar 12, 2026
4b17312
Remove quotes from trigger value in CSS coding standards rule file
shervElmi Mar 13, 2026
915a480
Change default filter tab from All to Featured and update action item…
shervElmi Mar 16, 2026
928f933
Remove unused toggleActionGroups function and click event binding for…
shervElmi Mar 16, 2026
b487c62
Add frmTabsNavigator class for tab navigation with filtering and slid…
shervElmi Mar 16, 2026
7532440
Extract filter functions from TabsNavigator into separate module for …
shervElmi Mar 16, 2026
c4a617b
Move visibility observer utilities to core utils module for broader r…
shervElmi Mar 16, 2026
9a4e251
Update import paths for TabsNavigator to reflect new tabs subdirector…
shervElmi Mar 16, 2026
8d4ba2f
Reset form actions styling to use card-based layout with icons and im…
shervElmi Mar 16, 2026
1bab89b
Reorganize form action widget header layout by moving drag handle bef…
shervElmi Mar 16, 2026
2c10669
Add auto-incrementing suffix to duplicate form action titles to preve…
shervElmi Mar 16, 2026
87b62fa
Update form action widget styling with flexbox layout and improved ic…
shervElmi Mar 16, 2026
560b5b6
Remove drag handle from form action widgets and add "Your Actions" he…
shervElmi Mar 16, 2026
3e8b6fb
Update webpack dev server configuration with new ports, improved file…
shervElmi Mar 17, 2026
890e1f2
Add custom color override for form action icons using CSS variable in…
shervElmi Mar 17, 2026
a24d321
Add outlined card styling to addon items in addons list
shervElmi Mar 17, 2026
9e3d184
Restructure form action icon template with outlined card styling and …
shervElmi Mar 17, 2026
b6fd029
Fix conditional logic in on_submit_migrated hidden field to properly …
shervElmi Mar 17, 2026
1be9f5e
Refactor card item styles to use nested selectors and add outlined ca…
shervElmi Mar 17, 2026
14ea3b3
Remove obsolete form action styling rules for email addon menu and ac…
shervElmi Mar 17, 2026
f355393
Update form settings heading styles with refined typography and spacing
shervElmi Mar 17, 2026
816d917
Add filter state management styles for form actions list with conditi…
shervElmi Mar 18, 2026
5fdded4
Add icon sizing and styling rules for form actions list with inactive…
shervElmi Mar 18, 2026
1283486
Refactor form action settings styles to use nested SCSS selectors wit…
shervElmi Mar 18, 2026
102fc9f
Refactor form action widget title styles to use nested SCSS selectors…
shervElmi Mar 18, 2026
0994e04
Remove obsolete form action icon styles and refactor email icons to u…
shervElmi Mar 18, 2026
6e21590
Remove frm-inverse class from form action icon styling across default…
shervElmi Mar 18, 2026
e8ea5d0
Remove obsolete action icon inactive state initialization and frm-inv…
shervElmi Mar 18, 2026
102007d
Replace frm-filter-hidden class with frm_hidden in content filter tog…
shervElmi Mar 18, 2026
7fb3c31
Refactor content filter to use internal state with getFilterTarget() …
shervElmi Mar 18, 2026
8a231ff
Refactor tabs navigator to use centralized filter target resolution f…
shervElmi Mar 18, 2026
e14b5b4
Remove obsolete upgrade prompt cursor styling for inactive form actio…
shervElmi Mar 18, 2026
d1f95b0
Simplify form actions filter and list styles by removing redundant se…
shervElmi Mar 18, 2026
e610297
Remove obsolete frm_actions_list margin override from desktop media q…
shervElmi Mar 18, 2026
b4984e2
Add bottom margin to actions filter tabs wrapper and remove default m…
shervElmi Mar 18, 2026
35918c5
Remove obsolete card item styles from addons page CSS
shervElmi Mar 19, 2026
94c6ed2
Remove border and padding from email settings headings and add consis…
shervElmi Mar 19, 2026
620b38f
Reduce horizontal padding on outlined action cards and set icon color…
shervElmi Mar 19, 2026
85a9f0e
Update form settings headings with new typography and spacing styles …
shervElmi Mar 19, 2026
db42fcc
Refactor form settings tabs styles to use nested SCSS syntax and upda…
shervElmi Mar 19, 2026
620f9d2
Update payment category label from "eCommerce" to "E-Commerce" in for…
shervElmi Mar 19, 2026
7862d0b
Add top margin to form actions menu wrapper and shorten search placeh…
shervElmi Mar 19, 2026
e2229f3
Add white-space nowrap to tab navigator labels to prevent text wrapping
shervElmi Mar 19, 2026
daa3faa
Add white-space nowrap to form settings tabs to prevent label wrappin…
shervElmi Mar 19, 2026
9f6a891
Update email addon menu layout to stack vertically on smaller desktop…
shervElmi Mar 19, 2026
c155934
Remove obsolete action menu class toggling logic from admin search fu…
shervElmi Mar 19, 2026
fd4f730
Add form actions search functionality to filter and toggle group head…
shervElmi Mar 19, 2026
12ed36e
Add is_new flag to action options and display "New" pill badge on n8n…
shervElmi Mar 20, 2026
9602b98
Add lock icon to upgrade-required action cards that don't have one-cl…
shervElmi Mar 20, 2026
31c1e9f
Redesign not-installed action cards to match new outlined card style …
shervElmi Mar 20, 2026
8fc1d88
feat(form-actions): surface on-submit action groups
shervElmi Mar 20, 2026
bc2e031
fix(FrmOnSubmitAction): update icon class and color for success messages
shervElmi Mar 20, 2026
3ba1aeb
refactor(form-actions): update action colors for improved consistency…
shervElmi Mar 20, 2026
4378617
fix(email_action): update color format for consistency in email actio…
shervElmi Mar 20, 2026
912b4f5
fix(icons): update PayPal icon for improved clarity and consistency i…
shervElmi Mar 20, 2026
593b48b
feat(form-actions): enhance action card styles with hover effects and…
shervElmi Mar 20, 2026
8a08805
fix(FrmTransLiteAction): update action color to hex format for consis…
shervElmi Mar 20, 2026
bed5dc7
refactor(form-action): improve layout and styling of action card comp…
shervElmi Mar 23, 2026
db714ef
fix(settings-advanced): correct value assignment for on_submit_migrat…
shervElmi Mar 23, 2026
f58ce61
style(frm-tab-navigator): update SCSS imports and improve padding for…
shervElmi Mar 23, 2026
a9c4fd3
style(form-actions): refine widget styles and improve hover effects f…
shervElmi Mar 23, 2026
1b82e63
refactor(frm-tabs-navigator): enhance documentation for visibility an…
shervElmi Mar 23, 2026
2189f29
refactor(form-actions): streamline action title generation by removin…
shervElmi Mar 23, 2026
7505fc9
feat(admin): add existing count to form action data for improved hand…
shervElmi Mar 23, 2026
f339b0b
refactor(form-actions): implement unique title generation for form ac…
shervElmi Mar 24, 2026
eed54e7
refactor(form-actions): replace existing count with titles in form ac…
shervElmi Mar 24, 2026
2b84634
feat(form-actions): add no actions message for improved user guidance…
shervElmi Mar 24, 2026
cdcb204
feat(form-actions): toggle visibility of no actions message based on …
shervElmi Mar 24, 2026
2be2526
refactor(form-actions): extract action icon attributes into a dedicat…
shervElmi Mar 24, 2026
a811968
refactor(form-actions): update icon rendering to use centralized meth…
shervElmi Mar 24, 2026
400ae5e
feat(variables): add new variable for x-small border radius to enhanc…
shervElmi Mar 24, 2026
c2141ef
style(form-actions): update icon color for frm-border-icon and stream…
shervElmi Mar 24, 2026
31f6b1c
feat(icons): add small variant for circled icons with adjusted dimens…
shervElmi Mar 24, 2026
ddb20e4
feat(typography): add new text color utility for primary-700 to enhan…
shervElmi Mar 24, 2026
f0ff930
feat(form-actions): implement dynamic visibility toggle for no result…
shervElmi Mar 24, 2026
be09d2b
style(form-actions): add typography classes to action headers for imp…
shervElmi Mar 24, 2026
c5f0f3a
style(form-actions): enhance layout and styling of action buttons and…
shervElmi Mar 24, 2026
86cbd4c
style(form-actions): update action icons to include text color utilit…
shervElmi Mar 24, 2026
c4ef54b
style(icons): update frm_trash_icon and frm_copy_icon to improve desi…
shervElmi Mar 24, 2026
725a42d
style(form-actions, typography): enhance button transitions and enfor…
shervElmi Mar 24, 2026
79f8d41
style(form-actions): update widget styling to enhance interactivity a…
shervElmi Mar 24, 2026
5992f67
style(form-actions, typography, components): refine widget styles, re…
shervElmi Mar 24, 2026
a17c118
style(form-actions): enhance widget hover effects and add email icon …
shervElmi Mar 24, 2026
e32179a
style(form-actions): update action icon classes for improved styling …
shervElmi Mar 30, 2026
bc4466a
style(form-actions): modify email icon class for enhanced animation e…
shervElmi Mar 30, 2026
288c1df
style(form-actions): add single action attributes for enhanced upgrad…
shervElmi Mar 30, 2026
6d99db2
style(animations): refactor animation timing using CSS variables for …
shervElmi Mar 30, 2026
ae370dd
style(form-actions): refactor action card styles for improved layout …
shervElmi Mar 30, 2026
50e07a8
style(icons): update frm_plus_icon to use stroke styling for improved…
shervElmi Mar 30, 2026
71c76ce
style(form-actions): remove truncation class from action name spans f…
shervElmi Mar 30, 2026
dfbb27a
style(form-actions): update padding and border radius for improved co…
shervElmi Mar 30, 2026
3946bdb
feat(form-actions): add default action descriptions for improved clar…
shervElmi Mar 31, 2026
649d4bb
style(form-actions): streamline action options initialization for imp…
shervElmi Mar 31, 2026
a77e967
style(form-actions): enhance section headers and adjust padding for i…
shervElmi Mar 31, 2026
adfc0d0
style(form-actions): update background color and adjust padding for i…
shervElmi Mar 31, 2026
681465c
style(form-actions): adjust label margin and enhance layout with flex…
shervElmi Mar 31, 2026
6dcc1fd
style(inputs): adjust button padding for improved consistency in form…
shervElmi Mar 31, 2026
a4ce738
style(form-settings): update border color for improved visual consist…
shervElmi Mar 31, 2026
5482309
style(border): add new border-top utility class for enhanced styling …
shervElmi Mar 31, 2026
9826f1c
feat(form-actions): add default action descriptions for 'on_submit' a…
shervElmi Mar 31, 2026
77a9f33
feat(form-actions): add 'payment' action description for transaction …
shervElmi Mar 31, 2026
c233b88
style(form-actions): adjust margin for 'add/remove' actions to improv…
shervElmi Mar 31, 2026
7b46ab7
style(panel-settings): update padding and margin for post tax option …
shervElmi Mar 31, 2026
39277b2
style(form-actions): add new post tax option list styling and refine …
shervElmi Apr 1, 2026
8da43af
style(settings-components): remove unused post tax option list styles…
shervElmi Apr 1, 2026
2495641
style(form-actions): update autoresponder action layout with improved…
shervElmi Apr 1, 2026
9300cb0
feat(admin): implement toggle reset functionality for hidden elements…
shervElmi Apr 1, 2026
22097f5
style(toggle-components): add cursor pointer to toggle elements and r…
shervElmi Apr 1, 2026
ec4565e
feat(form-actions): implement unlicensed action gate and add learn-mo…
shervElmi Apr 2, 2026
aee3150
feat(form-actions): enhance conditional logic rendering with action k…
shervElmi Apr 2, 2026
176a4c0
feat(form-actions): pass action key to conditional logic rendering fo…
shervElmi Apr 2, 2026
c3106ba
style(form-settings): adjust margin for updated message in form setti…
shervElmi Apr 2, 2026
46ac72a
feat(form-actions): refactor form logic row handling and add toggle c…
shervElmi Apr 2, 2026
aaaceb9
fix(upgrade-popup): conditionally display learn more link based on av…
shervElmi Apr 2, 2026
476b590
style(upgrade-modal): add conditional display styles for upgrade mess…
shervElmi Apr 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .windsurf/rules/formidable/frm-css.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
trigger: "glob"
trigger: glob
globs: ["**/*.css", "**/*.scss", "**/*.less"]
description: "WordPress CSS coding standards with Formidable Forms patterns. Auto-applies when working with CSS files."
---
Expand Down
261 changes: 239 additions & 22 deletions classes/controllers/FrmFormActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static function register_post_types() {
)
);

self::maybe_setup_unlicensed_action_gate();
self::actions_init();
}

Expand All @@ -56,25 +57,25 @@ public static function register_actions() {
'email' => 'FrmEmailAction',
'wppost' => 'FrmDefPostAction',
'register' => 'FrmDefRegAction',
'paypal' => 'FrmDefPayPalAction',
'payment' => 'FrmTransLiteAction',
'quiz' => 'FrmDefQuizAction',
'quiz_outcome' => 'FrmDefQuizOutcomeAction',
'mailchimp' => 'FrmDefMlcmpAction',
'paypal' => 'FrmDefPayPalAction',
'payment' => 'FrmTransLiteAction',
'api' => 'FrmDefApiAction',
'salesforce' => 'FrmDefSalesforceAction',
'mailchimp' => 'FrmDefMlcmpAction',
'activecampaign' => 'FrmDefActiveCampaignAction',
'constantcontact' => 'FrmDefConstContactAction',
'getresponse' => 'FrmDefGetResponseAction',
'hubspot' => 'FrmDefHubspotAction',
'zapier' => 'FrmDefZapierAction',
'n8n' => 'FrmDefN8NAction',
'twilio' => 'FrmDefTwilioAction',
'highrise' => 'FrmDefHighriseAction',
'mailpoet' => 'FrmDefMailpoetAction',
'aweber' => 'FrmDefAweberAction',
'convertkit' => 'FrmDefConvertKitAction',
'aweber' => 'FrmDefAweberAction',
'twilio' => 'FrmDefTwilioAction',
'salesforce' => 'FrmDefSalesforceAction',
'hubspot' => 'FrmDefHubspotAction',
'highrise' => 'FrmDefHighriseAction',
'zapier' => 'FrmDefZapierAction',
'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction',
'n8n' => 'FrmDefN8NAction',
);

$action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
Expand All @@ -86,6 +87,50 @@ public static function register_actions() {
foreach ( $action_classes as $action_class ) {
self::$registered_actions->register( $action_class );
}

self::apply_default_action_descriptions();
}

/**
* Sets default descriptions on registered actions from a central list.
*
* Keeps the description when an add-on replaces a base action class without its own.
*
* @since x.x
*
* @return void
*/
private static function apply_default_action_descriptions() {
$descriptions = array(
'on_submit' => __( 'Success messages', 'formidable' ),
'email' => __( 'Autoresponder alerts', 'formidable' ),
'wppost' => __( 'Content publishing', 'formidable' ),
'register' => __( 'Account creation', 'formidable' ),
'payment' => __( 'Transaction alerts', 'formidable' ),
'paypal' => __( 'Payment gateway', 'formidable' ),
'quiz' => __( 'Automated grading', 'formidable' ),
'quiz_outcome' => __( 'Result logic', 'formidable' ),
'aweber' => __( 'List triggers', 'formidable' ),
'mailchimp' => __( 'Subscription confirmation', 'formidable' ),
'zapier' => __( 'App automation', 'formidable' ),
'n8n' => __( 'Workflow automation', 'formidable' ),
'twilio' => __( 'Text notifications', 'formidable' ),
'activecampaign' => __( 'Contact automation', 'formidable' ),
'salesforce' => __( 'Lead automation', 'formidable' ),
'constantcontact' => __( 'Content distribution', 'formidable' ),
'getresponse' => __( 'Success notifications', 'formidable' ),
'hubspot' => __( 'CRM alerts', 'formidable' ),
'mailpoet' => __( 'Plugin automation', 'formidable' ),
'api' => __( 'System integration', 'formidable' ),
'googlespreadsheet' => __( 'Spreadsheet sync', 'formidable' ),
'convertkit' => __( 'Broadcast publishing', 'formidable' ),
);

foreach ( self::$registered_actions->actions as $action ) {
if ( $action->action_options['description'] === '' && isset( $descriptions[ $action->id_base ] ) ) {
$action->action_options['description'] = $descriptions[ $action->id_base ];
}
}
}

/**
Expand Down Expand Up @@ -170,24 +215,27 @@ public static function form_action_groups() {
'name' => '',
'icon' => 'frmfont frm_shuffle_icon',
'actions' => array(
'on_submit',
'email',
'wppost',
'register',
'quiz',
'quiz_outcome',
'twilio',
'api',
'googlespreadsheet',
'n8n',
),
),
'payment' => array(
'name' => __( 'eCommerce', 'formidable' ),
'name' => __( 'E-Commerce', 'formidable' ),
'icon' => 'frmfont frm_credit_card_alt_icon',
'actions' => array(
'paypal',
'payment',
),
),
'marketing' => array(
'name' => __( 'Email Marketing', 'formidable' ),
'name' => __( 'Marketing', 'formidable' ),
'icon' => 'frmfont frm_mail_bulk_icon',
'actions' => array(
'mailchimp',
Expand All @@ -197,6 +245,7 @@ public static function form_action_groups() {
'aweber',
'mailpoet',
'convertkit',
'twilio',
),
),
'crm' => array(
Expand All @@ -220,6 +269,7 @@ private static function get_crm_actions() {
$crm_actions = array(
'salesforce',
'hubspot',
'zapier',
);

// Only include Highrise when the add-on is active.
Expand Down Expand Up @@ -300,18 +350,40 @@ public static function show_action_icon_link( $action_control, $allowed ) {
if ( $requires && 'free' !== $requires ) {
$data['data-requires'] = $requires;
}

$learn_more_slug = ! empty( $action_control->action_options['learn-more'] )
? $action_control->action_options['learn-more']
: self::get_learn_more_slug( $action_control->id_base );

if ( $learn_more_slug ) {
$data['data-learn-more'] = FrmAppHelper::get_doc_url(
$learn_more_slug,
'settings-' . $action_control->id_base,
str_contains( $learn_more_slug, '/' )
);
}
}//end if

// HTML to include on the icon.
$icon_atts = array();
include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
}

if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
$icon_atts = array(
/**
* Get the HTML attributes for the action icon.
*
* @since x.x
*
* @param object $action_control
*
* @return array
*/
public static function get_action_icon_atts( $action_control ) {
if ( 'var(--primary-700)' !== $action_control->action_options['color'] ) {
return array(
'style' => '--primary-700:' . $action_control->action_options['color'],
);
}

include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
return array();
}

/**
Expand Down Expand Up @@ -380,6 +452,10 @@ public static function list_actions( $form, $values ) {

self::maybe_show_limit_warning( $form->id, $form_actions );

echo '<p class="frm-mb-lg frm-no-actions-message' . ( $form_actions ? ' frm_hidden' : '' ) . '"> '
. esc_html__( 'No actions have been added yet. Select an action above to get started.', 'formidable' )
. '</p>';

foreach ( $form_actions as $action ) {
if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
// Don't try and show settings if action no longer exists
Expand Down Expand Up @@ -448,19 +524,30 @@ public static function add_form_action() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );

$action_type = FrmAppHelper::get_param( 'type', '', 'post', 'sanitize_text_field' );
$lite_actions = array_fill_keys( self::get_lite_actions(), true );
if ( ! FrmAppHelper::pro_is_connected() && ! isset( $lite_actions[ $action_type ] ) ) {
wp_die();
}

global $frm_vars;

$action_key = FrmAppHelper::get_param( 'list_id', '', 'post', 'absint' );
$action_type = FrmAppHelper::get_param( 'type', '', 'post', 'sanitize_text_field' );
$action_key = FrmAppHelper::get_param( 'list_id', '', 'post', 'absint' );

/**
* @var FrmFormAction
*/
$action_control = self::get_form_actions( $action_type );
$action_control->_set( $action_key );

$form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
$form_action = $action_control->prepare_new( $form_id );
$form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
$form_action = $action_control->prepare_new( $form_id );
$existing_titles = (array) FrmAppHelper::get_post_param( 'existing_titles', array(), 'sanitize_text_field' );

if ( $existing_titles ) {
$form_action->post_title = self::get_unique_action_title( $form_action->post_title, $existing_titles );
}

$use_logging = self::should_show_log_message( $action_type );
$values = array();
$form = self::fields_to_values( $form_id, $values );
Expand All @@ -469,6 +556,27 @@ public static function add_form_action() {
wp_die();
}

/**
* Returns the first available title not in $existing_titles, appending " (2)", " (3)", etc. if needed.
*
* @since x.x
*
* @param string $base_title Default action title from the action type.
* @param string[] $existing_titles Titles currently visible in the form editor.
*
* @return string
*/
private static function get_unique_action_title( $base_title, array $existing_titles ) {
$taken = array_flip( $existing_titles );
$title = $base_title;

for ( $n = 2; isset( $taken[ $title ] ); $n++ ) {
$title = $base_title . ' (' . $n . ')';
}

return $title;
}

public static function fill_action() {
FrmAppHelper::permission_check( 'frm_edit_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );
Expand Down Expand Up @@ -801,6 +909,115 @@ public static function limit_by_type( $where ) {
public static function prevent_wpml_translations( $null, $post_type ) {
return self::$action_post_type === $post_type ? false : $null;
}

/**
* If Pro is not connected, hook a filter that will force all non-Lite
* actions to inactive so the upgrade popup is shown instead.
*
* @since x.x
*
* @return void
*/
private static function maybe_setup_unlicensed_action_gate() {
if ( FrmAppHelper::pro_is_connected() ) {
return;
}

add_filter( 'frm_registered_form_actions', array( __CLASS__, 'disable_unlicensed_actions' ), 100 );
}

/**
* For every registered action that is not a Lite action, add a per-action
* options filter that forces it to inactive with the upgrade class.
*
* Runs inside apply_filters('frm_registered_form_actions') at priority 100,
* so the per-key option filters are in place before the class constructors
* run in the foreach loop that follows.
*
* @since x.x
*
* @param array $actions Map of action_key => class_name.
*
* @return array
*/
public static function disable_unlicensed_actions( $actions ) {
$lite_actions = array_fill_keys( self::get_lite_actions(), true );

foreach ( array_keys( $actions ) as $key ) {
if ( isset( $lite_actions[ $key ] ) ) {
continue;
}

add_filter(
'frm_' . $key . '_action_options',
function ( $options ) {
$options['active'] = false;
if ( ! str_contains( $options['classes'], 'frm_show_upgrade' ) ) {
$options['classes'] .= ' frm_show_upgrade';
}
return $options;
}
);
}//end foreach

return $actions;
}

/**
* Get action keys that are available in Lite without a Pro license.
*
* @since x.x
*
* @return string[]
*/
public static function get_lite_actions() {
return apply_filters( 'frm_lite_form_actions', array( 'on_submit', 'email', 'payment' ) );
}

/**
* Single source of truth for learn-more doc slugs used in
* upgrade modals for non-Lite form actions.
*
* @since x.x
*
* @return array<string,string> Map of action_key => doc slug.
*/
public static function get_action_learn_more_links() {
return array(
'wppost' => 'using-add-form-actions#kb-create-a-post',
'register' => 'user-registration',
'paypal' => 'formidable-paypal',
'quiz' => 'quiz-maker-forms',
'quiz_outcome' => 'quiz-maker-forms',
'aweber' => 'formidable-aweber',
'mailchimp' => 'formidable-mailchimp',
'zapier' => 'formidable-zapier',
'twilio' => 'twilio-add-on',
'activecampaign' => 'activecampaign-forms',
'salesforce' => 'salesforce-forms',
'constantcontact' => 'constant-contact-forms',
'getresponse' => 'getresponse-forms',
'hubspot' => 'hubspot-forms',
'mailpoet' => 'mailpoet-newsletter-signup-forms',
'api' => 'formidable-api',
'googlespreadsheet' => 'google-spreadsheet-forms',
'n8n' => 'n8n',
'convertkit' => 'convertkit-forms',
);
}

/**
* Look up the learn-more doc slug for a given action key.
*
* @since x.x
*
* @param string $action_key Action identifier (e.g. 'register').
* @return string Doc slug or empty string.
*/
private static function get_learn_more_slug( $action_key ) {
$links = self::get_action_learn_more_links();
return isset( $links[ $action_key ] ) ? $links[ $action_key ] : '';
}
}

class Frm_Form_Action_Factory {
Expand Down
Loading
Loading