acf_field_gallery::get_rest_linkspublicACF 1.0

Method of the class: acf_field_gallery{}

No Hooks.

Returns

Array.

Usage

$acf_field_gallery = new acf_field_gallery();
$acf_field_gallery->get_rest_links( $value, $post_id, $field );
$value(mixed) (required)
The raw (unformatted) field value.
$post_id(int|string) (required)
.
$field(array) (required)
.

Notes

  • See: [acf_field::get_rest_links()](/plugin/acf/function/acf_field::get_rest_links)

acf_field_gallery::get_rest_links() code ACF 6.8.8

public function get_rest_links( $value, $post_id, array $field ) {
	$links = array();

	if ( empty( $value ) ) {
		return $links;
	}

	foreach ( (array) $value as $object_id ) {
		$links[] = array(
			'rel'        => 'acf:attachment',
			'href'       => rest_url( '/wp/v2/media/' . $object_id ),
			'embeddable' => true,
		);
	}

	return $links;
}