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