ACF_Local_JSON::get_save_pathspublicACF 6.2

Gets the path(s) to save JSON to.

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

Хуки из метода

Возвращает

Массив.

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

$ACF_Local_JSON = new ACF_Local_JSON();
$ACF_Local_JSON->get_save_paths( $key, $post );
$key(строка)
The key to get paths for (optional).
По умолчанию: ''
$post(массив)
The main ACF post array (optional).
По умолчанию: array()

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

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

Код ACF_Local_JSON::get_save_paths() ACF 6.4.2

public function get_save_paths( $key = '', $post = array() ) {
	$name      = ! empty( $post['title'] ) ? (string) $post['title'] : '';
	$post_type = acf_determine_internal_post_type( $key );
	$paths     = array();

	// Paths are sorted by priority, with key overriding name, etc.
	$paths[] = acf_get_setting( "save_json/key={$key}" );
	$paths[] = acf_get_setting( "save_json/name={$name}" );
	$paths[] = acf_get_setting( "save_json/type={$post_type}" );
	$paths[] = acf_get_setting( 'save_json' );
	$paths   = array_values( array_filter( $paths ) );

	/**
	 * Filters the paths used to save JSON.
	 *
	 * @since 6.2
	 *
	 * @param array $paths An array of the potential paths to save JSON to.
	 * @param array $post  The ACF field group, post type, or taxonomy array.
	 * @return array
	 */
	return (array) apply_filters( 'acf/json/save_paths', $paths, $post );
}