WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row( string $dependency )

In this article

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

Parameters

$dependencystringrequired
The dependency’s filepath, relative to the plugins directory.

Source

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
	);
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.