function _responsive_favicons_normalise_path in Responsive Favicons 8
Same name and namespace in other branches
- 7 responsive_favicons.module \_responsive_favicons_normalise_path()
Help to normalise the path to the icons.
Parameters
$file_path: The filename of the icon.
Return value
string The full relative path to the icon within public files.
2 calls to _responsive_favicons_normalise_path()
- ResponsiveFaviconsAdmin::submitForm in src/
Form/ ResponsiveFaviconsAdmin.php - Form submission handler.
- _responsive_favicons_validate_tags in ./
responsive_favicons.module - Helper function to check whether responsive favicon files exist and are readable. This function also strips any pasted content that is not a link or a meta tag.
File
- ./
responsive_favicons.module, line 178 - Contains responsive_favicons.module.
Code
function _responsive_favicons_normalise_path($file_path) {
$config = \Drupal::config('responsive_favicons.settings');
// Remove absolute URLs.
if (UrlHelper::isExternal($file_path)) {
$file_path = str_replace(\Drupal::request()
->getSchemeAndHttpHost(), '', $file_path);
}
if ($config
->get('path_type') === 'upload') {
return '/' . PublicStream::basePath() . '/' . $config
->get('path') . $file_path;
}
else {
return $config
->get('path') . $file_path;
}
}