You are here

protected function ResourceEntity::dataProviderClassName in RESTful 7.2

Data provider class.

Return value

string The name of the class of the provider factory.

Overrides Resource::dataProviderClassName

1 call to ResourceEntity::dataProviderClassName()
ResourceEntity::dataProviderFactory in src/Plugin/resource/ResourceEntity.php
Data provider factory.
3 methods override ResourceEntity::dataProviderClassName()
Comments__1_0::dataProviderClassName in modules/restful_example/src/Plugin/resource/comment/Comments__1_0.php
Data provider class.
FilesUploadTest__1_0::dataProviderClassName in tests/modules/restful_test/src/Plugin/resource/file/file_upload_test/v1/FilesUploadTest__1_0.php
Data provider class.
TestTags__1_0::dataProviderClassName in tests/modules/restful_test/src/Plugin/resource/taxonomy_term/v1/TestTags__1_0.php
Data provider class.

File

src/Plugin/resource/ResourceEntity.php, line 76
Contains \Drupal\restful\Plugin\resource\ResourceEntity.

Class

ResourceEntity

Namespace

Drupal\restful\Plugin\resource

Code

protected function dataProviderClassName() {

  // This helper function allows to map a resource to a different data
  // provider class.
  if ($this
    ->getEntityType() == 'node') {
    return '\\Drupal\\restful\\Plugin\\resource\\DataProvider\\DataProviderNode';
  }
  elseif ($this
    ->getEntityType() == 'taxonomy_term') {
    return '\\Drupal\\restful\\Plugin\\resource\\DataProvider\\DataProviderTaxonomyTerm';
  }
  elseif ($this
    ->getEntityType() == 'file') {
    return '\\Drupal\\restful\\Plugin\\resource\\DataProvider\\DataProviderFile';
  }
  return '\\Drupal\\restful\\Plugin\\resource\\DataProvider\\DataProviderEntity';
}