Skip to content

Commit

Permalink
Linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Dec 10, 2024
1 parent 9ab94f3 commit 9f9a244
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check failure on line 46 in lib/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Expected 1 space after FUNCTION keyword; 0 found

Check warning on line 46 in lib/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

It is recommended not to use reserved keyword "object" as function parameter name. Found: $object
'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(

Check warning on line 56 in lib/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Missing $domain parameter in function call to __(). If this text string is supposed to use a WP Core translation, use the "default" text domain.
'description' => __( 'Link to the post type archive page' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
)
);
}
add_action( 'rest_api_init', 'gutenberg_register_archive_link_field' );
add_action( 'rest_api_init', 'gutenberg_register_archive_link_field' );

0 comments on commit 9f9a244

Please sign in to comment.