Validates data for a template tag.
Description
See also
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
Version | Description |
---|---|
1.0.0 | Introduced. |