REST_Element_Choices_Controller::prepare_links( awsmug\Torro_Forms\DB_Objects\Element_Choices\Element_Choice $element_choice )

Prepares links for the request.

Description

Parameters

$element_choice

(awsmug\Torro_Forms\DB_Objects\Element_Choices\Element_Choice) (Required) Element choice object.

Return

(array) Links for the given element choice.

Source

File: src/db-objects/element-choices/rest-element-choices-controller.php

	protected function prepare_links( $element_choice ) {
		$links = parent::prepare_links( $element_choice );

		if ( ! empty( $element_choice->element_id ) ) {
			$links['parent_element'] = array(
				'href' => rest_url( trailingslashit( sprintf( '%s/%s', $this->namespace, 'elements' ) ) . $element_choice->element_id ),
			);
		}

		return $links;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.