LLMS_REST_Access_Plans_Controller::prepare_links( LLMS_Access_Plan $access_plan, WP_REST_Request $request )

Prepare links for the request


Parameters Parameters

$access_plan

(LLMS_Access_Plan) (Required) LLMS Access Plan instance.

$request

(WP_REST_Request) (Required) Request object.


Top ↑

Return Return

(array) Links for the given object.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-access-plans-controller.php

		$links['post'] = array(
			'href' => rest_url(
				sprintf(
					'%s/%s/%s',
					'llms/v1',
					'course' === $access_plan->get_product_type() ? 'courses' : 'memberships',
					$access_plan->get( 'product_id' )
				)
			),
		);

		// Membership restrictions.
		if ( $access_plan->has_availability_restrictions() ) {
			$links['restrictions'] = array(
				'href' => rest_url(
					sprintf(
						'%s/%s?include=%s',
						'llms/v1',
						'memberships',
						implode( ',', $access_plan->get_array( 'availability_restrictions' ) )
					)
				),
			);
		}

		/**
		 * Filters the access plan's links.
		 *
		 * @since 1.0.0-beta.18
		 *
		 * @param array            $links       Links for the given access plan.
		 * @param LLMS_Access_Plan $access_plan LLMS Access Plan instance.
		 */
		return apply_filters( 'llms_rest_access_plan_links', $links, $access_plan );

	}

	/**
	 * Prepare a single object output for response.
	 *
	 * @since 1.0.0-beta.18


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.18 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.