This function’s access is marked private. This means it is not intended for use by other plugin or theme developers, only in this plugin itself. It is listed here for completeness.

Template_Tag_Handler::validate_tag_data( array $data )

Validates data for a template tag.

Description

Parameters

$data

(array) (Required) Template tag data to validate.

Return

(array) Validated template tag data.

Source

File: src/components/template-tag-handler.php

	private function validate_tag_data( $data ) {
		if ( ! is_array( $data ) ) {
			/* translators: 1: template tag slug, 2: template tag handler slug */
			throw new InvalidArgumentException( sprintf( __( 'Invalid template tag %1$s for handler %2$s.', 'torro-forms' ), $slug, $this->slug ) );
		}

		if ( empty( $data['label'] ) || empty( $data['callback'] ) ) {
			/* translators: 1: template tag slug, 2: template tag handler slug */
			throw new InvalidArgumentException( sprintf( __( 'Invalid template tag %1$s for handler %2$s.', 'torro-forms' ), $slug, $this->slug ) );
		}

		if ( ! isset( $data['description'] ) ) {
			$data['description'] = '';
		}

		if ( ! isset( $data['group'] ) ) {
			$data['group'] = 'default';
		}

		return $data;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.