function language_hierarchy_preprocess_image_formatter in Language Hierarchy 2.x
Same name and namespace in other branches
- 8 language_hierarchy.module \language_hierarchy_preprocess_image_formatter()
 
Implements hook_preprocess_image_formatter().
1 call to language_hierarchy_preprocess_image_formatter()
- language_hierarchy_preprocess_responsive_image_formatter in ./
language_hierarchy.module  - Implements hook_preprocess_image_formatter().
 
File
- ./
language_hierarchy.module, line 549  - Add sublanguage handling functionality to Drupal.
 
Code
function language_hierarchy_preprocess_image_formatter(&$variables) {
  if (!empty($variables['url'])) {
    $url = $variables['url'];
    if ($url instanceof Url) {
      // Check if the URL is for a translatable entity's canonical link. Do not
      // change any other kind of link.
      $entity = $url
        ->getOption('entity');
      if ($entity && $entity instanceof TranslatableInterface) {
        $variables['url'] = language_hierarchy_fix_url_from_fallback($url, $entity);
      }
    }
  }
}