Change record status: 
Project: 
Introduced in branch: 
12.1.x
Introduced in version: 
12.1.0
Description: 

Calling LinkFormatter::__construct() or LinkWidget::__construct() without a Psr\Log\LoggerInterface argument is deprecated in Drupal 12.1.0 and will be required in Drupal 13.0.0.

The link module now injects the logger.channel.link service into both LinkFormatter and LinkWidget so that invalid URLs encountered during rendering or form building are logged with a warning instead of failing silently.

Subclasses overriding LinkFormatter or LinkWidget should update their constructor to pass a LoggerInterface instance:

Before

public function __construct(
  $plugin_id,
  $plugin_definition,
  FieldDefinitionInterface $field_definition,
  array $settings,
  $label,
  $view_mode,
  array $third_party_settings,
  PathValidatorInterface $pathValidator,
) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $pathValidator);
}

After

public function __construct(
  $plugin_id,
  $plugin_definition,
  FieldDefinitionInterface $field_definition,
  array $settings,
  $label,
  $view_mode,
  array $third_party_settings,
  PathValidatorInterface $pathValidator,
  LoggerInterface $logger,
) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $pathValidator, $logger);
}
Impacts: 
Module developers