WordPress at a glance
function is not described

WP_REST_Plugins_Controller::prepare_item_for_response() public WP 5.5.0

Prepares the plugin for the REST response.

{} It's a method of the class: WP_REST_Plugins_Controller{}

Hooks from the method
Return

WP_REST_Response/WP_Error. Response object on success, or WP_Error object on failure.

Usage

$WP_REST_Plugins_Controller = new WP_REST_Plugins_Controller();
$WP_REST_Plugins_Controller->prepare_item_for_response( $item, $request );
$item(mixed) (required)
Unmarked up and untranslated plugin data from get_plugin_data().
$request(WP_REST_Request) (required)
Request object.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Plugins_Controller::prepare_item_for_response() WP 5.5.1

<?php
public function prepare_item_for_response( $item, $request ) {
	$item   = _get_plugin_data_markup_translate( $item['_file'], $item, false );
	$marked = _get_plugin_data_markup_translate( $item['_file'], $item, true );

	$data = array(
		'plugin'       => substr( $item['_file'], 0, - 4 ),
		'status'       => $this->get_plugin_status( $item['_file'] ),
		'name'         => $item['Name'],
		'plugin_uri'   => $item['PluginURI'],
		'author'       => $item['Author'],
		'author_uri'   => $item['AuthorURI'],
		'description'  => array(
			'raw'      => $item['Description'],
			'rendered' => $marked['Description'],
		),
		'version'      => $item['Version'],
		'network_only' => $item['Network'],
		'requires_wp'  => $item['RequiresWP'],
		'requires_php' => $item['RequiresPHP'],
		'textdomain'   => $item['TextDomain'],
	);

	$data = $this->add_additional_fields_to_object( $data, $request );

	$response = new WP_REST_Response( $data );
	$response->add_links( $this->prepare_links( $item ) );

	/**
	 * Filters the plugin data for a response.
	 *
	 * @since 5.5.0
	 *
	 * @param WP_REST_Response $response The response object.
	 * @param array            $item     The plugin item from {@see get_plugin_data()}.
	 * @param WP_REST_Request  $request  The request object.
	 */
	return apply_filters( 'rest_prepare_plugin', $response, $item, $request );
}