BP_REST_Activity_Link_Preview_Endpoint::get_item_schema()

Get the plugin schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-activity/classes/class-bp-rest-activity-link-preview-endpoint.php

	public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'bp_activity_link_preview',
			'type'       => 'object',
			'properties' => array(
				'title'       => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Title for the link preview.', 'buddyboss' ),
					'type'        => 'string',
					'readonly'    => true,
				),
				'description' => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Description or HTML to generate the link preview.', 'buddyboss' ),
					'type'        => 'string',
					'readonly'    => true,
				),
				'images'      => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Image URLs for the preview.', 'buddyboss' ),
					'type'        => 'array',
					'readonly'    => true,
					'items'       => array(
						'type' => 'string',
					),
				),
				'error'       => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'If any errors to retrieving a the preview data.', 'buddyboss' ),
					'type'        => 'string',
					'readonly'    => true,
				),
				'wp_embed'    => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Whether the URL is wp embed or not.', 'buddyboss' ),
					'type'        => 'boolean',
					'readonly'    => true,
				),
			),
		);

		/**
		 * Filters the activity link preview schema.
		 *
		 * @param string $schema The endpoint schema.
		 */
		return apply_filters( 'bp_rest_activity_link_preview_schema', $this->add_additional_fields_schema( $schema ) );
	}

Changelog

Changelog
Version Description
0.1.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.