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.

Метод класса: WP_Plugins_List_Table{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_dependents_to_dependency_plugin_row( $dependency );
$dependency(строка) (обязательный)
The dependency's filepath, relative to the plugins directory.

Список изменений

С версии 6.5.0 Введена.

Код WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row() WP 6.7.2

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