WordPress at a glance
function is not described

WP_REST_Block_Directory_Controller::find_plugin_for_slug() protected WP 5.5.0

Finds an installed plugin for the given slug.

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

No Hooks.

Return

String. The plugin file found matching it.

Usage

// protected - for code of main (parent) or child class
$result = $this->find_plugin_for_slug( $slug );
$slug(string) (required)
The WordPress.org directory slug for a plugin.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Block_Directory_Controller::find_plugin_for_slug() WP 5.5.1

<?php
protected function find_plugin_for_slug( $slug ) {
	require_once ABSPATH . 'wp-admin/includes/plugin.php';

	$plugin_files = get_plugins( '/' . $slug );

	if ( ! $plugin_files ) {
		return '';
	}

	$plugin_files = array_keys( $plugin_files );

	return $slug . '/' . reset( $plugin_files );
}