wpcf7_hidden_form_tag_handler

The Contact Form 7 wpcf7 hidden form tag handler function.

Description

wpcf7_hidden_form_tag_handler( $tag ); 

Parameters (1)

0. $tag
The tag.

Usage

  1. if ( !function_exists( 'wpcf7_hidden_form_tag_handler' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/hidden.php'; 
  3.  
  4. // The tag. 
  5. $tag = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_hidden_form_tag_handler($tag); 
  9.  

Defined (1)

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

/modules/hidden.php  
  1. function wpcf7_hidden_form_tag_handler( $tag ) { 
  2. $tag = new WPCF7_FormTag( $tag ); 
  3.  
  4. if ( empty( $tag->name ) ) { 
  5. return ''; 
  6.  
  7. $atts = array(); 
  8.  
  9. $class = wpcf7_form_controls_class( $tag->type ); 
  10. $atts['class'] = $tag->get_class_option( $class ); 
  11. $atts['id'] = $tag->get_id_option(); 
  12.  
  13. $value = (string) reset( $tag->values ); 
  14. $value = $tag->get_default_option( $value ); 
  15. $atts['value'] = $value; 
  16.  
  17. $atts['type'] = 'hidden'; 
  18. $atts['name'] = $tag->name; 
  19. $atts = wpcf7_format_atts( $atts ); 
  20.  
  21. $html = sprintf( '<input %s />', $atts ); 
  22. return $html;