function ResourceType::hasField
Same name in other branches
- 9 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::hasField()
- 10 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::hasField()
- 11.x core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::hasField()
Checks if the field exists.
Note: a minority of config entity types which do not define a `config_export` in their entity type annotation will not have their fields represented here because it is impossible to determine them without an instance of config available.
@todo Refactor this in Drupal 9, because thanks to https://www.drupal.org/project/drupal/issues/2949021, `config_export` will be guaranteed to exist, and this won't need an instance anymore.
Parameters
string $field_name: The internal field name.
Return value
bool TRUE if the field is known to exist on the resource type; FALSE otherwise.
1 call to ResourceType::hasField()
- ResourceType::isFieldEnabled in core/
modules/ jsonapi/ src/ ResourceType/ ResourceType.php - Checks if a field is enabled or not.
File
-
core/
modules/ jsonapi/ src/ ResourceType/ ResourceType.php, line 234
Class
- ResourceType
- Value object containing all metadata for a JSON:API resource type.
Namespace
Drupal\jsonapi\ResourceTypeCode
public function hasField($field_name) {
return array_key_exists($field_name, $this->fields);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.