WPCF7_Editor

The Contact Form 7 WPCF7 Editor class.

Defined (1)

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

/admin/includes/editor.php  
  1. class WPCF7_Editor { 
  2.  
  3. private $contact_form; 
  4. private $panels = array(); 
  5.  
  6. public function __construct( WPCF7_ContactForm $contact_form ) { 
  7. $this->contact_form = $contact_form; 
  8.  
  9. public function add_panel( $id, $title, $callback ) { 
  10. if ( wpcf7_is_name( $id ) ) { 
  11. $this->panels[$id] = array( 
  12. 'title' => $title,  
  13. 'callback' => $callback,  
  14. ); 
  15.  
  16. public function display() { 
  17. if ( empty( $this->panels ) ) { 
  18. return; 
  19.  
  20. echo '<ul id="contact-form-editor-tabs">'; 
  21.  
  22. foreach ( $this->panels as $id => $panel ) { 
  23. echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>',  
  24. esc_attr( $id ), esc_html( $panel['title'] ) ); 
  25.  
  26. echo '</ul>'; 
  27.  
  28. foreach ( $this->panels as $id => $panel ) { 
  29. echo sprintf( '<div class="contact-form-editor-panel" id="%1$s">',  
  30. esc_attr( $id ) ); 
  31.  
  32. if ( is_callable( $panel['callback'] ) ) { 
  33. $this->notice( $id, $panel ); 
  34. call_user_func( $panel['callback'], $this->contact_form ); 
  35.  
  36. echo '</div>'; 
  37.  
  38. public function notice( $id, $panel ) { 
  39. echo '<div class="config-error"></div>';