WPCF7_ContactForm::collect_mail_tags()
Collects mail-tags available for this contact form.
Метод класса: WPCF7_ContactForm{}
Хуки из метода
Возвращает
Массив
. Mail-tag names.
Использование
$WPCF7_ContactForm = new WPCF7_ContactForm(); $WPCF7_ContactForm->collect_mail_tags( $options );
- $options(строка|массив)
- Search options.
По умолчанию: ''
Код WPCF7_ContactForm::collect_mail_tags() WPCF7 ContactForm::collect mail tags CF7 6.0.2
public function collect_mail_tags( $options = '' ) { $manager = WPCF7_FormTagsManager::get_instance(); $options = wp_parse_args( $options, array( 'include' => array(), 'exclude' => $manager->collect_tag_types( 'not-for-mail' ), ) ); $tags = $this->scan_form_tags(); $mailtags = array(); foreach ( (array) $tags as $tag ) { $type = $tag->basetype; if ( empty( $type ) ) { continue; } elseif ( ! empty( $options['include'] ) ) { if ( ! in_array( $type, $options['include'] ) ) { continue; } } elseif ( ! empty( $options['exclude'] ) ) { if ( in_array( $type, $options['exclude'] ) ) { continue; } } $mailtags[] = $tag->name; } $mailtags = array_unique( $mailtags ); $mailtags = array_filter( $mailtags ); $mailtags = array_values( $mailtags ); return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $options, $this ); }