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;
}
$active_panel_id = trim( $_GET['active-tab'] ?? '' );
if ( ! array_key_exists( $active_panel_id, $this->panels ) ) {
$active_panel_id = array_key_first( $this->panels );
}
echo '';
foreach ( $this->panels as $panel_id => $panel ) {
$active = $panel_id === $active_panel_id;
echo sprintf(
'',
wpcf7_format_atts( array(
'id' => $panel_id,
'class' => 'contact-form-editor-panel' . ( $active ? ' active' : '' ),
) )
);
if ( is_callable( $panel['callback'] ) ) {
call_user_func( $panel['callback'], $this->contact_form );
}
echo '';
}
}
}
function wpcf7_editor_panel_form( $post ) {
$desc_link = wpcf7_link(
__( 'https://contactform7.com/editing-form-template/', 'contact-form-7' ),
__( 'Editing form template', 'contact-form-7' ) );
$description = __( "You can edit the form template here. For details, see %s.", 'contact-form-7' );
$description = sprintf( esc_html( $description ), $desc_link );
?>
';
wpcf7_editor_box_mail( $post, array(
'id' => 'wpcf7-mail-2',
'name' => 'mail_2',
'title' => __( 'Mail (2)', 'contact-form-7' ),
'use' => __( 'Use Mail (2)', 'contact-form-7' ),
) );
}
function wpcf7_editor_box_mail( $post, $options = '' ) {
$options = wp_parse_args( $options, array(
'id' => 'wpcf7-mail',
'name' => 'mail',
'title' => __( 'Mail', 'contact-form-7' ),
'use' => null,
) );
$id = esc_attr( $options['id'] );
$mail = wp_parse_args( $post->prop( $options['name'] ), array(
'active' => false,
'recipient' => '',
'sender' => '',
'subject' => '',
'body' => '',
'additional_headers' => '',
'attachments' => '',
'use_html' => false,
'exclude_blank' => false,
) );
?>