WP_Script_Modules::get_dependents
Gets all dependents of a script module.
This is not recursive.
Метод класса: WP_Script_Modules{}
Хуков нет.
Возвращает
Строку[]. Script module IDs.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_dependents( $id ): array;
- $id(строка) (обязательный)
- The script ID.
Заметки
- Смотрите: WP_Scripts::get_dependents()
Список изменений
| С версии 6.9.0 | Введена. |
Код WP_Script_Modules::get_dependents() WP Script Modules::get dependents WP 6.9
private function get_dependents( string $id ): array {
// Check if dependents map for the handle in question is present. If so, use it.
if ( isset( $this->dependents_map[ $id ] ) ) {
return $this->dependents_map[ $id ];
}
$dependents = array();
// Iterate over all registered scripts, finding dependents of the script passed to this method.
foreach ( $this->registered as $registered_id => $args ) {
if ( in_array( $id, wp_list_pluck( $args['dependencies'], 'id' ), true ) ) {
$dependents[] = $registered_id;
}
}
// Add the module's dependents to the map to ease future lookups.
$this->dependents_map[ $id ] = $dependents;
return $dependents;
}