WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row()protectedWP 6.5.0

Prints a list of other plugins that depend on the plugin.

Method of the class: WP_Plugins_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->add_dependents_to_dependency_plugin_row( $dependency );
$dependency(string) (required)
The dependency's filepath, relative to the plugins directory.

Changelog

Since 6.5.0 Introduced.

WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row() code WP 6.5.4

protected function add_dependents_to_dependency_plugin_row( $dependency ) {
	$dependent_names = WP_Plugin_Dependencies::get_dependent_names( $dependency );

	if ( empty( $dependent_names ) ) {
		return;
	}

	$dependency_note = __( 'Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );

	$comma       = wp_get_list_item_separator();
	$required_by = sprintf(
		/* translators: %s: List of dependencies. */
		__( '<strong>Required by:</strong> %s' ),
		implode( $comma, $dependent_names )
	);

	printf(
		'<div class="required-by"><p>%1$s</p><p>%2$s</p></div>',
		$required_by,
		$dependency_note
	);
}