WPCF7_ContactForm::get_template
Returns a contact form data filled by default template contents.
Метод класса: WPCF7_ContactForm{}
Хуки из метода
Возвращает
WPCF7_ContactForm. A new contact form object.
Использование
$result = WPCF7_ContactForm::get_template( $options );
- $options(строка|массив)
- Contact form options.
По умолчанию:''
Код WPCF7_ContactForm::get_template() WPCF7 ContactForm::get template CF7 6.1.6
public static function get_template( $options = '' ) {
$options = wp_parse_args( $options, array(
'locale' => null,
'title' => __( 'Untitled', 'contact-form-7' ),
) );
if ( ! isset( $options['locale'] ) ) {
$options['locale'] = determine_locale();
}
$callback = static function ( $options ) {
$contact_form = new self();
$contact_form->title = $options['title'];
$contact_form->locale = $options['locale'];
$properties = $contact_form->get_properties();
foreach ( $properties as $key => $value ) {
$default_template = WPCF7_ContactFormTemplate::get_default( $key );
if ( isset( $default_template ) ) {
$properties[$key] = $default_template;
}
}
$contact_form->properties = $properties;
return $contact_form;
};
$contact_form = wpcf7_switch_locale(
$options['locale'],
$callback,
$options
);
self::$current = apply_filters( 'wpcf7_contact_form_default_pack',
$contact_form, $options
);
return self::$current;
}