You are here

protected function ResourceEntity::processPublicFields in RESTful 7.2

Get the public fields with the default values applied to them.

Parameters

array $field_definitions: The field definitions to process.

Return value

array The field definition array.

Throws

\Drupal\restful\Exception\ServerConfigurationException For resources without ID field.

Overrides Resource::processPublicFields

2 calls to ResourceEntity::processPublicFields()
Main__1_7::processPublicFields in tests/modules/restful_test/src/Plugin/resource/entity_test/main/v1/Main__1_7.php
Get the public fields with the default values applied to them.
TestArticles__1_0::processPublicFields in tests/modules/restful_test/src/Plugin/resource/node/test_article/v1/TestArticles__1_0.php
Get the public fields with the default values applied to them.
2 methods override ResourceEntity::processPublicFields()
Main__1_7::processPublicFields in tests/modules/restful_test/src/Plugin/resource/entity_test/main/v1/Main__1_7.php
Get the public fields with the default values applied to them.
TestArticles__1_0::processPublicFields in tests/modules/restful_test/src/Plugin/resource/node/test_article/v1/TestArticles__1_0.php
Get the public fields with the default values applied to them.

File

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

Class

ResourceEntity

Namespace

Drupal\restful\Plugin\resource

Code

protected function processPublicFields(array $field_definitions) {

  // The fields that only contain a property need to be set to be
  // ResourceFieldEntity. Otherwise they will be considered regular
  // ResourceField.
  return array_map(function ($field_definition) {
    $field_entity_class = '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldEntity';
    $class_name = ResourceFieldEntity::fieldClassName($field_definition);
    if (!$class_name || is_subclass_of($class_name, $field_entity_class)) {
      $class_name = $field_entity_class;
    }
    return $field_definition + array(
      'class' => $class_name,
      'entityType' => $this
        ->getEntityType(),
    );
  }, $field_definitions);
}