You are here

public function FileUsageBase::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/file/src/FileUsage/FileUsageBase.php \Drupal\file\FileUsage\FileUsageBase::__construct()
  2. 10 core/modules/file/src/FileUsage/FileUsageBase.php \Drupal\file\FileUsage\FileUsageBase::__construct()

Creates a FileUsageBase object.

@todo Update the docblock and make $config_factory required in https://www.drupal.org/project/drupal/issues/3070114 when the drupal:9.0.x branch is opened.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory. This parameter is required as of drupal:8.4.0 and trigger a fatal error if not passed in drupal:9.0.0.

1 call to FileUsageBase::__construct()
DatabaseFileUsageBackend::__construct in core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php
Creates a FileUsageBase object.
1 method overrides FileUsageBase::__construct()
DatabaseFileUsageBackend::__construct in core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php
Creates a FileUsageBase object.

File

core/modules/file/src/FileUsage/FileUsageBase.php, line 31

Class

FileUsageBase
Defines the base class for database file usage backend.

Namespace

Drupal\file\FileUsage

Code

public function __construct(ConfigFactoryInterface $config_factory = NULL) {

  // @todo Remove below conditional when the drupal:9.0.x branch is opened.
  // @see https://www.drupal.org/project/drupal/issues/3070114
  if (empty($config_factory)) {
    @trigger_error('Not passing the $config_factory parameter to ' . __METHOD__ . ' is deprecated in drupal:8.4.0 and will trigger a fatal error in drupal:9.0.0. See https://www.drupal.org/project/drupal/issues/2801777', E_USER_DEPRECATED);
    $config_factory = \Drupal::configFactory();
  }
  $this->configFactory = $config_factory;
}