WordPress Version: 4.7
/**
* Get the Page Templates available in this theme
*
* @since 1.5.0
* @since 4.7.0 Added the `$post_type` parameter.
*
* @param WP_Post|null $post Optional. The post being edited, provided for context.
* @param string $post_type Optional. Post type to get the templates for. Default 'page'.
* @return array Key is the template name, value is the filename of the template
*/
function get_page_templates($post = null, $post_type = 'page')
{
return array_flip(wp_get_theme()->get_page_templates($post, $post_type));
}