WP Manifestindependent plugin directory
manifest / forms / gravity-flow-step-css-class

Gravity Flow Step CSS Class

Gravity Flow Step CSS Class

by Abundant Designs · github.com/robertstaddon/gravity-flow-step-css-class · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/robertstaddon/gravity-flow-step-css-class/archive/refs/heads/main.zip

Adds Gravity Forms merge tags {current_step_class} and {current_step_class:complete} that output the current Gravity Flow step name, or when the workflow has finished either the entry’s workflow_final_status (default) or the configured Workflow Complete step name (:complete), as a lowercase, dash-separated string suitable for HTML class attributes.


Description

Gravity Flow exposes rich step names (spaces, mixed case, punctuation). This plugin derives a predictable CSS-safe slug from that label so you can target rows, wrappers, or icons in notifications, confirmations, GravityView Custom Content, and anywhere else Gravity Forms processes merge tags for a known entry.

Examples

Situation Tag Typical output
Current step Legal Review {current_step_class} legal-review
Current step QA - Final {current_step_class} qa-final
Workflow ended; status complete {current_step_class} complete
Workflow ended after approval (workflow_final_status = approved) {current_step_class} approved
Same entry; Complete step named All Done (Gravity Flow 2.5+) {current_step_class:complete} all-done

Requirements

The plugin does nothing until both Gravity Forms and Gravity Flow are active.


Installation

  1. Download or clone this repository.
  2. Upload the gravity-flow-step-css-class folder to /wp-content/plugins/.
  3. Activate Gravity Flow Step CSS Class in Plugins → Installed Plugins.

Or zip the folder and upload via Plugins → Add New → Upload Plugin.


Usage

  1. Edit a notification, confirmation, or any text field that supports Gravity Forms merge tags (including GravityView Custom Content).
  2. Insert {current_step_class} or {current_step_class:complete} from the merge tag list, or type them manually. The :complete suffix follows the same colon modifier style as core tags (e.g. {all_fields:nopricing}).

HTML examples

<div class="workflow-status {current_step_class}">
  …
</div>

<div class="workflow-end {current_step_class:complete}">
  …
</div>

The value is passed through esc_attr() when replaced.


How the value is built

  1. If the entry has a current Gravity Flow step, the step’s display name (get_name()) is used as the source string (both merge tags behave the same while the workflow is active).
  2. If there is no current step but workflow_final_status is set and not pending:
    • {current_step_class} — the status string is used (e.g. complete, approved, rejected). cancelled is always represented this way.
    • {current_step_class:complete} — if Gravity Flow provides a Workflow Complete step (2.5+) and it has a step name, that name is used instead; otherwise the plugin falls back to the same status string as the default tag.
  3. The source string is normalized: lowercased; spaces, tabs, underscores, and dots become dashes; any character that is not a–z, 0–9, or - is removed; repeated dashes are collapsed; leading/trailing dashes are trimmed.
  4. If the result would be empty but a current step exists, a fallback of step-{id} is used (numeric feed ID).

Unknown modifiers (e.g. {current_step_class:foo}) are left unreplaced.


Development

  • Version: see GF_STEP_CSS_CLASS_VERSION and the plugin header in gravity-flow-step-css-class.php.
  • Text domain: gravity-flow-step-css-class

Changelog

1.2.0

  • Switch class slug output from underscore-separated values to dash-separated values.
  • Bump plugin version and stable tag.

1.1.0

  • Add {current_step_class:complete} to use the configured Workflow Complete step name when the workflow has finished (instead of workflow_final_status values such as approved). Default {current_step_class} behavior is unchanged.
  • Document colon modifiers and edge cases in this readme.

1.0.0

  • Initial release: {current_step_class} merge tag; no shortcode.

Credits

Author: Abundant Designs


License

This plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version.

Gravity Forms and Gravity Flow are trademarks of their respective owners. This project is not affiliated with or endorsed by Rocketgenius or Steven Henty S.L.