acf_field_repeater::get_ajax_render_id │ private │ ACF 6.8.11

Returns the render ID of the form a paginated repeater's rows are loaded for.

Matches the render IDs the forms use: options pages are rendered for the page, widgets for their widget type, and other objects for their ACF post ID.

Метод класса: acf_field_repeater{}

Хуков нет.

Возвращает

string.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_ajax_render_id( $args );
$args(массив) (обязательный)
The request args.

Список изменений

С версии 6.8.11 Введена.

Код acf_field_repeater::get_ajax_render_id() ACF 6.8.11

private function get_ajax_render_id( $args ) {
	$slug = sanitize_text_field( (string) $args['options_page_slug'] );
	if ( '' !== $slug ) {
		return 'options/' . $slug;
	}

	$post_id = sanitize_text_field( (string) $args['post_id'] );
	if ( preg_match( '/^widget_(.+)-\d+$/', $post_id, $matches ) ) {
		return acf_form_widget::get_render_id( $matches[1] );
	}

	return $post_id;
}