You are here

public function ResourceType::isFieldEnabled in Drupal 9

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

Checks if a field is enabled or not.

This is only here so we can allow polymorphic implementations to take a greater control on the data model.

Parameters

string $field_name: The internal field name.

Return value

bool TRUE if the field exists and is enabled and should be considered as part of the data model. FALSE otherwise.

File

core/modules/jsonapi/src/ResourceType/ResourceType.php, line 254

Class

ResourceType
Value object containing all metadata for a JSON:API resource type.

Namespace

Drupal\jsonapi\ResourceType

Code

public function isFieldEnabled($field_name) {
  return $this
    ->hasField($field_name) && $this->fields[$field_name]
    ->isFieldEnabled();
}