/**
* Prepare a raw block pattern before it gets output in a REST API response.
*
* @since 6.0.0
* @since 6.3.0 Added `source` property.
*
* @param array $item Raw pattern as registered, before any changes.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function prepare_item_for_response( $item, $request ) {
$fields = $this->get_fields_for_response( $request );
$keys = array(
'name' => 'name',
'title' => 'title',
'content' => 'content',
'description' => 'description',
'viewportWidth' => 'viewport_width',
'inserter' => 'inserter',
'categories' => 'categories',
'keywords' => 'keywords',
'blockTypes' => 'block_types',
'postTypes' => 'post_types',