You are here

protected function TestArticles__1_0::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 ResourceEntity::processPublicFields

File

tests/modules/restful_test/src/Plugin/resource/node/test_article/v1/TestArticles__1_0.php, line 61
Contains \Drupal\restful_test\Plugin\resource\node\test_article\v1\TestArticles__1_0.

Class

TestArticles__1_0
Class TestArticles__1_0 @package Drupal\restful\Plugin\resource

Namespace

Drupal\restful_test\Plugin\resource\node\test_article\v1

Code

protected function processPublicFields(array $field_definitions) {
  $field_definitions = parent::processPublicFields($field_definitions);
  if (!($altered_public_name = variable_get('restful_test_revoke_public_field_access'))) {
    return $field_definitions;
  }
  foreach ($field_definitions as $public_name => &$field_definition) {
    if ($public_name != $altered_public_name) {
      continue;
    }
    $field_definition['access_callbacks'] = array(
      array(
        $this,
        'publicFieldAccessFalse',
      ),
    );
  }
  return $field_definitions;
}