You are here

protected function Main__1_7::publicFields in RESTful 7.2

Overrides ResourceEntity::publicFields().

Overrides ResourceEntity::publicFields

File

tests/modules/restful_test/src/Plugin/resource/entity_test/main/v1/Main__1_7.php, line 41
Contains \Drupal\restful_test\Plugin\resource\entity_test\main\v1\Main__1_7.

Class

Main__1_7
Class Main__1_7 @package Drupal\restful_test\Plugin\resource

Namespace

Drupal\restful_test\Plugin\resource\entity_test\main\v1

Code

protected function publicFields() {
  $public_fields = parent::publicFields();
  $public_fields['uuid'] = array(
    'property' => 'uuid',
    'methods' => array(),
  );

  // Single entity reference field without "resource".
  $public_fields['entity_reference_single'] = array(
    'property' => 'entity_reference_single',
    'referencedIdProperty' => 'uuid',
  );

  // Single entity reference field with "resource" that loads by uuid.
  $public_fields['entity_reference_resource'] = array(
    'property' => 'entity_reference_single',
    'referencedIdProperty' => 'uuid',
    'resource' => array(
      'name' => 'main',
      'majorVersion' => 1,
      'minorVersion' => 7,
    ),
  );

  // Multiple entity reference field without "resource".
  $public_fields['entity_reference_multiple'] = array(
    'property' => 'entity_reference_multiple',
    'referencedIdProperty' => 'uuid',
  );
  $public_fields['term_single'] = array(
    'property' => 'term_single',
    'referencedIdProperty' => 'uuid',
  );
  $public_fields['term_multiple'] = array(
    'property' => 'term_multiple',
    'referencedIdProperty' => 'uuid',
  );
  $public_fields['file_single'] = array(
    'property' => 'file_single',
    'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldFileEntityReference',
    'referencedIdProperty' => 'uuid',
  );
  $public_fields['file_multiple'] = array(
    'property' => 'file_multiple',
    'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldFileEntityReference',
    'referencedIdProperty' => 'uuid',
  );
  return $public_fields;
}