WPCF7_Editor{}
Хуков нет.
Использование
$WPCF7_Editor = new WPCF7_Editor(); // use class methods
Методы
- public __construct( WPCF7_ContactForm $contact_form )
- public add_panel( $panel_id, $title, $callback )
- public display()
- public notice( $panel_id, $panel )
Код WPCF7_Editor{} WPCF7 Editor{} CF7 5.9.8
class WPCF7_Editor { private $contact_form; private $panels = array(); public function __construct( WPCF7_ContactForm $contact_form ) { $this->contact_form = $contact_form; } public function add_panel( $panel_id, $title, $callback ) { if ( wpcf7_is_name( $panel_id ) ) { $this->panels[$panel_id] = array( 'title' => $title, 'callback' => $callback, ); } } public function display() { if ( empty( $this->panels ) ) { return; } echo '<ul id="contact-form-editor-tabs">'; foreach ( $this->panels as $panel_id => $panel ) { echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>', esc_attr( $panel_id ), esc_html( $panel['title'] ) ); } echo '</ul>'; foreach ( $this->panels as $panel_id => $panel ) { echo sprintf( '<div class="contact-form-editor-panel" id="%1$s">', esc_attr( $panel_id ) ); if ( is_callable( $panel['callback'] ) ) { $this->notice( $panel_id, $panel ); call_user_func( $panel['callback'], $this->contact_form ); } echo '</div>'; } } public function notice( $panel_id, $panel ) { echo '<div class="config-error"></div>'; } }