Tribe__Events__Pro__Editor__Meta::register_additional_fields()

Register the fields used by dynamic fields into the REST API

Contents


Source

File: src/Tribe/Editor/Meta.php

	public function register_additional_fields() {
		$additional_fields = array_values( tribe_get_option( 'custom-fields', array() ) );
		foreach ( $additional_fields as $field ) {

			$has_fields = isset( $field['name'], $field['type'], $field['gutenberg_editor'] );
			if ( ! $has_fields ) {
				continue;
			}

			switch ( $field['type'] ) {
				case 'textarea':
					$args = $this->textarea();
					break;
				case 'url':
					$args = $this->url();
					break;
				case 'checkbox':
					$args = $this->text();
					register_meta( 'post', '_' . $field['name'], $this->text_array() );
					break;
				default:
					$args = $this->text();
					break;
			}
			register_meta( 'post', $field['name'], $args );
		}
	}

Top ↑

Changelog

Changelog
Version Description
4.5 Introduced.