Problem/Motivation
Because of this issue #2850373: Incompatibility with remote_stream_wrapper module in the ImageAPI Optimize module there is a need to replace the ImageStyle
entity class with another which is compatible and implements ImageStyleInterface
. However, the Focal Point module type-hints the concrete implementation \Drupal\image\Entity\ImageStyle
in \Drupal\focal_point\Controller\FocalPointPreviewController::buildUrl
class FocalPointPreviewController extends ControllerBase {
...
/**
* Create the URL for a preview image including a query parameter.
*
* @param \Drupal\image\Entity\ImageStyle $style
...
*/
protected function buildUrl(ImageStyle $style, File $image, $focal_point_value) {
...
}
...
}
This causes the following TypeError
TypeError: Argument 1 passed to Drupal\focal_point\Controller\FocalPointPreviewController::buildUrl() must be an instance of Drupal\image\Entity\ImageStyle, instance of Drupal\entity_decorator\Entity\Replacements\ImageStyle given, called in /var/www/html/docroot/modules/contrib/focal_point/src/Controller/FocalPointPreviewController.php on line 108 in Drupal\focal_point\Controller\FocalPointPreviewController->buildUrl() (line 248 of /var/www/html/docroot/modules/contrib/focal_point/src/Controller/FocalPointPreviewController.php)
Proposed resolution
Change the type-hint to the interface \Drupal\image\ImageStyleInterface
Remaining tasks
Review needed.
Comment | File | Size | Author |
---|---|---|---|
#2 | focal_point-type_hint_imagestyleinterface-3084662-2-D8.patch | 1.5 KB | vtcore |
|
Comments
Comment #2
vtcore CreditAttribution: vtcore at FFW commentedPatch provided for the current 8.x-1.x branch.
Comment #3
vtcore CreditAttribution: vtcore at FFW commentedComment #4
vtcore CreditAttribution: vtcore at FFW commentedHey, anything else needed here?
Comment #6
bleen CreditAttribution: bleen at NBCUniversal commentedseems completely reasonable