WPCF7_FormTagsManager::add()publicCF7 1.0

Registers form-tag types to the manager.

Метод класса: WPCF7_FormTagsManager{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$WPCF7_FormTagsManager = new WPCF7_FormTagsManager();
$WPCF7_FormTagsManager->add( $tag_types, $callback, $features );
$tag_types(строка|массив) (обязательный)
The name of the form-tag type or an array of the names.
$callback(callable) (обязательный)
The callback to generates a form control HTML for a form-tag in this type.
$features(строка|массив)
Features a form-tag in this type supports.
По умолчанию: ''

Код WPCF7_FormTagsManager::add() CF7 5.6.4

public function add( $tag_types, $callback, $features = '' ) {
	if ( ! is_callable( $callback ) ) {
		return;
	}

	if ( true === $features ) { // for back-compat
		$features = array( 'name-attr' => true );
	}

	$features = wp_parse_args( $features, array() );

	$tag_types = array_filter( array_unique( (array) $tag_types ) );

	foreach ( $tag_types as $tag_type ) {
		$tag_type = $this->sanitize_tag_type( $tag_type );

		if ( ! $this->tag_type_exists( $tag_type ) ) {
			$this->tag_types[$tag_type] = array(
				'function' => $callback,
				'features' => $features,
			);
		}
	}
}