WPSEO_Admin_Asset_Manager::register_script()
Registers scripts based on it's parameters.
Метод класса: WPSEO_Admin_Asset_Manager{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WPSEO_Admin_Asset_Manager = new WPSEO_Admin_Asset_Manager(); $WPSEO_Admin_Asset_Manager->register_script( $script );
- $script(WPSEO_Admin_Asset) (обязательный)
- The script to register.
Код WPSEO_Admin_Asset_Manager::register_script() WPSEO Admin Asset Manager::register script Yoast 24.0
public function register_script( WPSEO_Admin_Asset $script ) { $url = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false; $args = [ 'in_footer' => $script->is_in_footer(), ]; if ( $script->get_strategy() !== '' ) { $args['strategy'] = $script->get_strategy(); } wp_register_script( $this->prefix . $script->get_name(), $url, $script->get_deps(), $script->get_version(), $args ); if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) { wp_set_script_translations( $this->prefix . $script->get_name(), 'wordpress-seo' ); } }