You are here

public function DataProvider::__construct in RESTful 7.2

Constructor.

Parameters

RequestInterface $request: The request.

ResourceFieldCollectionInterface $field_definitions: The field definitions.

object $account: The authenticated account.

string $plugin_id: The resource ID.

string $resource_path: The resource path.

array $options: The plugin options for the data provider.

string $langcode: (Optional) The entity language code.

5 calls to DataProvider::__construct()
DataProviderDbQuery::__construct in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Constructor.
DataProviderEntity::__construct in src/Plugin/resource/DataProvider/DataProviderEntity.php
Constructor.
DataProviderPlug::__construct in src/Plugin/resource/DataProvider/DataProviderPlug.php
Constructor.
DataProviderResource::__construct in src/Plugin/resource/DataProvider/DataProviderResource.php
Constructor.
DataProviderVariable::__construct in modules/restful_example/src/Plugin/resource/variables/DataProviderVariable.php
Constructor.
5 methods override DataProvider::__construct()
DataProviderDbQuery::__construct in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Constructor.
DataProviderEntity::__construct in src/Plugin/resource/DataProvider/DataProviderEntity.php
Constructor.
DataProviderPlug::__construct in src/Plugin/resource/DataProvider/DataProviderPlug.php
Constructor.
DataProviderResource::__construct in src/Plugin/resource/DataProvider/DataProviderResource.php
Constructor.
DataProviderVariable::__construct in modules/restful_example/src/Plugin/resource/variables/DataProviderVariable.php
Constructor.

File

src/Plugin/resource/DataProvider/DataProvider.php, line 160
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProvider.

Class

DataProvider

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

public function __construct(RequestInterface $request, ResourceFieldCollectionInterface $field_definitions, $account, $plugin_id, $resource_path = NULL, array $options = array(), $langcode = NULL) {
  $this->request = $request;
  $this->fieldDefinitions = $field_definitions;
  $this->account = $account;
  $this->pluginId = $plugin_id;
  $this->options = $options;
  $this->resourcePath = $resource_path;
  if (!empty($options['range'])) {

    // TODO: Document that the range is now overridable in the annotation.
    $this->range = $options['range'];
  }
  $this->langcode = $langcode ?: static::getLanguage();
  $this->metadata = new ArrayCollection();
}