WPSEO_Admin_Asset_SEO_Location::get_path()protectedYoast 1.0

Determines the path relative to the plugin folder of an asset.

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

Хуков нет.

Возвращает

Строку. The path to the asset file.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_path( $asset, $type );
$asset(WPSEO_Admin_Asset) (обязательный)
The asset to determine the path for.
$type(строка) (обязательный)
The type of asset.

Код WPSEO_Admin_Asset_SEO_Location::get_path() Yoast 22.4

protected function get_path( WPSEO_Admin_Asset $asset, $type ) {
	$relative_path = '';
	$rtl_suffix    = '';

	switch ( $type ) {
		case WPSEO_Admin_Asset::TYPE_JS:
			$relative_path = 'js/dist/' . $asset->get_src();
			if ( $this->add_suffix ) {
				$relative_path .= $asset->get_suffix() . '.js';
			}
			break;

		case WPSEO_Admin_Asset::TYPE_CSS:
			// Path and suffix for RTL stylesheets.
			if ( is_rtl() && $asset->has_rtl() ) {
				$rtl_suffix = '-rtl';
			}
			$relative_path = 'css/dist/' . $asset->get_src() . $rtl_suffix . $asset->get_suffix() . '.css';
			break;
	}

	return $relative_path;
}