Template_Tag_WYSIWYG_Field::single_to_json( mixed $current_value )

Transforms single field data into an array to be passed to JavaScript applications.

Description

Parameters

$current_value

(mixed) (Required) Current value of the field.

Return

(array) Field data to be JSON-encoded.

Source

File: src/components/template-tag-wysiwyg-field.php

	protected function single_to_json( $current_value ) {
		$data = parent::single_to_json( $current_value );

		$data['templateTags'] = array();
		foreach ( $this->template_tag_handler->get_groups() as $group_slug => $group_label ) {
			$data['templateTags'][ $group_slug ] = array(
				'label' => $group_label,
				'tags'  => $this->template_tag_handler->get_tag_labels( $group_slug ),
			);
		}

		return $data;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.