You are here

public function ResourceTypeField::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/ResourceType/ResourceTypeField.php \Drupal\jsonapi\ResourceType\ResourceTypeField::__construct()
  2. 10 core/modules/jsonapi/src/ResourceType/ResourceTypeField.php \Drupal\jsonapi\ResourceType\ResourceTypeField::__construct()

ResourceTypeField constructor.

Parameters

string $internal_name: The internal field name.

string $public_name: (optional) The public field name. Defaults to the internal field name.

bool $enabled: (optional) Whether the field is enabled. Defaults to TRUE.

bool $has_one: (optional) Whether the field can only have ony value. Defaults to TRUE.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeField.php, line 58

Class

ResourceTypeField
Abstract value object containing all metadata for a JSON:API resource field.

Namespace

Drupal\jsonapi\ResourceType

Code

public function __construct($internal_name, $public_name = NULL, $enabled = TRUE, $has_one = TRUE) {
  $this->internalName = $internal_name;
  $this->publicName = $public_name ?: $internal_name;
  $this->enabled = $enabled;
  $this->hasOne = $has_one;
}