public function ResourceEntity::dataProviderFactory in RESTful 7.2
Data provider factory.
Return value
DataProviderEntityInterface The data provider for this resource.
Throws
Overrides Resource::dataProviderFactory
File
- src/Plugin/ resource/ ResourceEntity.php, line 56 
- Contains \Drupal\restful\Plugin\resource\ResourceEntity.
Class
Namespace
Drupal\restful\Plugin\resourceCode
public function dataProviderFactory() {
  $plugin_definition = $this
    ->getPluginDefinition();
  $field_definitions = $this
    ->getFieldDefinitions();
  if (!empty($plugin_definition['dataProvider']['viewMode'])) {
    $field_definitions_array = $this
      ->viewModeFields($plugin_definition['dataProvider']['viewMode']);
    $field_definitions = ResourceFieldCollection::factory($field_definitions_array, $this
      ->getRequest());
  }
  $class_name = $this
    ->dataProviderClassName();
  if (!class_exists($class_name)) {
    throw new ServerConfigurationException(sprintf('The DataProvider could not be found for this resource: %s.', $this
      ->getResourceMachineName()));
  }
  return new $class_name($this
    ->getRequest(), $field_definitions, $this
    ->getAccount(), $this
    ->getPluginId(), $this
    ->getPath(), $plugin_definition['dataProvider']);
}