gf_do_action

The Gravity Forms gf do action function.

Description

gf_do_action( $action ); 

Parameters (1)

0. $action
The action.

Usage

  1. if ( !function_exists( 'gf_do_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-forms/gravityforms.php'; 
  3.  
  4. // The action. 
  5. $action = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gf_do_action($action); 
  9.  

Defined (1)

The function is defined in the following location(s).

/gravityforms.php  
  1. function gf_do_action( $action ) { 
  2.  
  3. $args = func_get_args(); 
  4.  
  5. if( is_array( $action ) ) { 
  6. // func parameters are: $action, $value 
  7. $modifiers = array_splice( $action, 1, count( $action ) ); 
  8. $action = $action[0]; 
  9. $args = array_slice( $args, 1 ); 
  10. } else { 
  11. //_deprecated_argument( 'gf_do_action', '1.9.14.20', "Modifiers should no longer be passed as a separate parameter. Combine the action name and modifier(s) into an array and pass that array as the first parameter of the function. Example: gf_do_action( array( 'action_name', 'mod1', 'mod2' ), \$arg1, \$arg2 );" ); 
  12. // func parameters are: $action, $modifier, $value 
  13. $modifiers = ! is_array( $args[1] ) ? array( $args[1] ) : $args[1]; 
  14. $args = array_slice( $args, 2 ); 
  15.  
  16. // add an empty modifier so the base filter will be applied as well 
  17. array_unshift( $modifiers, '' ); 
  18.  
  19. $args = array_pad( $args, 10, null ); 
  20.  
  21. // apply modified versions of filter 
  22. foreach ( $modifiers as $modifier ) { 
  23. $modifier = empty( $modifier ) ? '' : sprintf( '_%s', $modifier ); 
  24. $action .= $modifier; 
  25. do_action( $action, $args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9] );