diff --git a/css/focal_point_preview.css b/css/focal_point_preview.css index 50ff21b..a75efa5 100644 --- a/css/focal_point_preview.css +++ b/css/focal_point_preview.css @@ -43,4 +43,4 @@ color: #999999; font-size: .8em; text-align: center; -} \ No newline at end of file +} diff --git a/focal_point.libraries.yml b/focal_point.libraries.yml index 40e6456..3fb50c6 100644 --- a/focal_point.libraries.yml +++ b/focal_point.libraries.yml @@ -17,4 +17,4 @@ drupal.focal_point_preview: js/focal_point_preview.js: {} css: theme: - css/focal_point_preview.css: {} \ No newline at end of file + css/focal_point_preview.css: {} diff --git a/js/focal_point_preview.js b/js/focal_point_preview.js index a94ccf4..10af923 100644 --- a/js/focal_point_preview.js +++ b/js/focal_point_preview.js @@ -37,7 +37,7 @@ event.stopPropagation(); }); }); - + $(window).click(function(event) { resetPreview(); }); diff --git a/src/Controller/FocalPointPreviewController.php b/src/Controller/FocalPointPreviewController.php index 240e30e..1a6bd53 100644 --- a/src/Controller/FocalPointPreviewController.php +++ b/src/Controller/FocalPointPreviewController.php @@ -9,6 +9,7 @@ namespace Drupal\focal_point\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\image\Entity\ImageStyle; use Drupal\file\Entity\File; +use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Class FocalPointPreviewController. @@ -17,6 +18,8 @@ use Drupal\file\Entity\File; */ class FocalPointPreviewController extends ControllerBase { + use StringTranslationTrait; + /** * {@inheritdoc} */ @@ -57,7 +60,7 @@ class FocalPointPreviewController extends ControllerBase { 'image' => [ '#theme' => 'image', '#uri' => $url, - '#alt' => t('Focal Point Preview: %label', array('%label' => $style_label)), + '#alt' => $this->t('Focal Point Preview: %label', array('%label' => $style_label)), '#attributes' => [ 'class' => ['focal-point-derivative-preview-image'], ], @@ -70,8 +73,8 @@ class FocalPointPreviewController extends ControllerBase { "#original_image" => $original_image, '#derivative_images' => $derivative_images, '#focal_point' => $focal_point_value, - '#preview_image_note' => t('This preview image above may have been scaled to fit on the page.'), - '#derivative_image_note' => t('Click an image to see a larger preview. You may need to scroll horizontally for more image styles.'), + '#preview_image_note' => $this->t('This preview image above may have been scaled to fit on the page.'), + '#derivative_image_note' => $this->t('Click an image to see a larger preview. You may need to scroll horizontally for more image styles.'), ); return $output;