You are here

protected function ResourceEntity::publicFields in RESTful 7.2

Public fields.

Return value

array The field definition array.

Overrides Resource::publicFields

20 calls to ResourceEntity::publicFields()
Articles__1_1::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_1.php
Public fields.
Articles__1_5::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_5.php
Overrides ResourceNode::publicFields().
Articles__1_6::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_6.php
Overrides ResourceNode::publicFields().
Articles__2_1::publicFields in modules/restful_example/src/Plugin/resource/node/article/v2/Articles__2_1.php
Public fields.
Comments__1_0::publicFields in modules/restful_example/src/Plugin/resource/comment/Comments__1_0.php
Public fields.

... See full list

20 methods override ResourceEntity::publicFields()
Articles__1_1::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_1.php
Public fields.
Articles__1_5::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_5.php
Overrides ResourceNode::publicFields().
Articles__1_6::publicFields in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_6.php
Overrides ResourceNode::publicFields().
Articles__2_1::publicFields in modules/restful_example/src/Plugin/resource/node/article/v2/Articles__2_1.php
Public fields.
Comments__1_0::publicFields in modules/restful_example/src/Plugin/resource/comment/Comments__1_0.php
Public fields.

... See full list

File

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

Class

ResourceEntity

Namespace

Drupal\restful\Plugin\resource

Code

protected function publicFields() {
  $public_fields = array();
  $public_fields['id'] = array(
    'wrapper_method' => 'getIdentifier',
    'wrapper_method_on_entity' => TRUE,
    'methods' => array(
      RequestInterface::METHOD_GET,
      RequestInterface::METHOD_OPTIONS,
    ),
    'discovery' => array(
      // Information about the field for human consumption.
      'info' => array(
        'label' => t('ID'),
        'description' => t('Base ID for the entity.'),
      ),
      // Describe the data.
      'data' => array(
        'cardinality' => 1,
        'read_only' => TRUE,
        'type' => 'integer',
        'required' => TRUE,
      ),
    ),
  );
  $public_fields['label'] = array(
    'wrapper_method' => 'label',
    'wrapper_method_on_entity' => TRUE,
    'discovery' => array(
      // Information about the field for human consumption.
      'info' => array(
        'label' => t('Label'),
        'description' => t('The label of the resource.'),
      ),
      // Describe the data.
      'data' => array(
        'type' => 'string',
      ),
      // Information about the form element.
      'form_element' => array(
        'type' => 'textfield',
        'size' => 255,
      ),
    ),
  );
  $public_fields['self'] = array(
    'callback' => array(
      $this,
      'getEntitySelf',
    ),
  );
  return $public_fields;
}