acf_form_comment::restrict_save_input │ private │ ACF 6.8.11

Restricts the submitted values to fields rendered for the comment, or belonging to field groups whose comment location rules match the comment's post type.

New comments are rendered for the post they are posted on; existing comments for themselves.

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

Хуков нет.

Возвращает

void. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->restrict_save_input( $comment_id );
$comment_id(int) (обязательный)
The ID of comment being saved.

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

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

Код acf_form_comment::restrict_save_input() ACF 6.8.11

private function restrict_save_input( $comment_id ) {
	$comment    = get_comment( $comment_id );
	$render_ids = array();
	$screen     = array();

	if ( $comment ) {
		$render_ids = array( current_action() === 'comment_post' ? 'comment_new/' . $comment->comment_post_ID : 'comment_' . $comment->comment_ID );
		$screen     = array( 'comment' => get_post_type( $comment->comment_post_ID ) );
	}

	acf_restrict_save_input(
		array(
			'context'    => 'comment',
			'post_id'    => 'comment_' . $comment_id,
			'render_ids' => $render_ids,
			'screen'     => $screen,
			'filter_arg' => $comment_id,
		)
	);
}