sc_actionbar_clicked_state()

The sc_actionbar_clicked_state() macro allows the developer to retrieve the current state of an action bar button at the moment it is clicked.
This enables validation of the button's current state and allows changes based on the system's business rules.

This macro is exclusive to AJAX events for action bar buttons.


Examples

Example 1: Identifying the current state of the button in an AJAX event to toggle its state when clicked.

if (sc_actionbar_clicked_state() == 'pending') {
    sc_actionbar_state('ajax_btn', 'sent');
} else {
    sc_actionbar_state('ajax_btn', 'pending');
}

Example 2: Displaying the current state of the button.

echo sc_actionbar_clicked_state();