public function File::__construct in Drupal 9
Constructs a File object.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator: The file URL generator.
Overrides HandlerBase::__construct
File
- core/
modules/ file/ src/ Plugin/ views/ field/ File.php, line 41
Class
- File
- Field handler to provide simple renderer that allows linking to a file.
Namespace
Drupal\file\Plugin\views\fieldCode
public function __construct(array $configuration, $plugin_id, $plugin_definition, FileUrlGeneratorInterface $file_url_generator = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if (!$file_url_generator) {
@trigger_error('Calling File::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0 and the $file_url_generator argument will be required in drupal:10.0.0. See https://www.drupal.org/node/2940031', E_USER_DEPRECATED);
$file_url_generator = \Drupal::service('file_url_generator');
}
$this->fileUrlGenerator = $file_url_generator;
}