Skip to content
Snippets Groups Projects

3023322 - Contextual Links Style Update

2 files
+ 161
4
Compare changes
  • Side-by-side
  • Inline
Files
2
  • b568675f
    Issue #3255887 by murilohp, heddn, catch, neclimdul, Berdir, daffie:... · b568675f
    catch authored
    Issue #3255887 by murilohp, heddn, catch, neclimdul, Berdir, daffie: MediaThumbnailFormatter => Calling ImageFormatter::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0
@@ -4,6 +4,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\File\FileUrlGeneratorInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\image\ImageStyleStorageInterface;
@@ -55,11 +56,21 @@ class MediaThumbnailFormatter extends ImageFormatter {
* The current user.
* @param \Drupal\image\ImageStyleStorageInterface $image_style_storage
* The image style entity storage handler.
* @param \Drupal\Core\Render\RendererInterface $renderer
* @param \Drupal\Core\File\FileUrlGeneratorInterface|null $file_url_generator
* The file URL generator.
* @param \Drupal\Core\Render\RendererInterface|null $renderer
* The renderer service.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, ImageStyleStorageInterface $image_style_storage, RendererInterface $renderer) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $current_user, $image_style_storage);
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, ImageStyleStorageInterface $image_style_storage, $file_url_generator = NULL, $renderer = NULL) {
if (!$file_url_generator instanceof FileUrlGeneratorInterface) {
$file_url_generator = \Drupal::service('file_url_generator');
@trigger_error('Calling ' . __METHOD__ . '() without the $file_url_generator argument is deprecated in drupal:9.3.0 and $file_url_generator argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3255887', E_USER_DEPRECATED);
}
if (!$renderer instanceof RendererInterface) {
$renderer = \Drupal::service('renderer');
@trigger_error('Calling ' . __METHOD__ . '() without the $renderer argument is deprecated in drupal:9.3.0 and $renderer argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3255887', E_USER_DEPRECATED);
}
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $current_user, $image_style_storage, $file_url_generator);
$this->renderer = $renderer;
}
@@ -77,6 +88,7 @@ public static function create(ContainerInterface $container, array $configuratio
$configuration['third_party_settings'],
$container->get('current_user'),
$container->get('entity_type.manager')->getStorage('image_style'),
$container->get('file_url_generator'),
$container->get('renderer')
);
}
@@ -97,7 +109,6 @@ protected function needsEntityLoad(EntityReferenceItem $item) {
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$link_types = [
'content' => $this->t('Content'),
'media' => $this->t('Media item'),
Loading