diff --git a/lib/rest-api.php b/lib/rest-api.php index a583c648de5a34..a863a890f0a91c 100644 --- a/lib/rest-api.php +++ b/lib/rest-api.php @@ -39,25 +39,26 @@ function gutenberg_register_edit_site_export_controller_endpoints() { add_action( 'rest_api_init', 'gutenberg_register_edit_site_export_controller_endpoints' ); - - - function gutenberg_register_archive_link_field() { - register_rest_field( 'type', 'archive_link', array( - 'get_callback' => function( $object ) { - if ( isset( $object['has_archive'] ) && $object['has_archive'] ) { - $post_type = $object['slug']; - $archive_link = get_post_type_archive_link( $post_type ); - return $archive_link ? $archive_link : ''; - } - return ''; - }, - 'update_callback' => null, - 'schema' => array( - 'description' => __( 'Link to the post type archive page' ), - 'type' => 'string', - 'context' => array( 'view', 'edit' ), - ), - ) ); + register_rest_field( + 'type', + 'archive_link', + array( + 'get_callback' => function( $object ) { + if ( isset( $object['has_archive'] ) && $object['has_archive'] ) { + $post_type = $object['slug']; + $archive_link = get_post_type_archive_link( $post_type ); + return $archive_link ? $archive_link : ''; + } + return ''; + }, + 'update_callback' => null, + 'schema' => array( + 'description' => __( 'Link to the post type archive page' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + ), + ) + ); } -add_action( 'rest_api_init', 'gutenberg_register_archive_link_field' ); \ No newline at end of file +add_action( 'rest_api_init', 'gutenberg_register_archive_link_field' );