You are here

protected static function FieldResolver::getPathPartPropertyName in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::getPathPartPropertyName()

Gets the property name from an entity typed or untyped path part.

A path part may contain an entity type specifier like `entity:node`. This extracts the actual property name. If an entity type is not specified, then the path part is simply returned. For example, both `foo` and `foo:bar` will return `foo`.

Parameters

string $part: A path part.

Return value

string The property name from a path part.

2 calls to FieldResolver::getPathPartPropertyName()
FieldResolver::isCandidateDefinitionProperty in src/Context/FieldResolver.php
Determines if a path part targets a field property, not a subsequent field.
FieldResolver::isCandidateDefinitionReferenceProperty in src/Context/FieldResolver.php
Determines if a path part targets a reference property.

File

src/Context/FieldResolver.php, line 639

Class

FieldResolver
A service that evaluates external path expressions against Drupal fields.

Namespace

Drupal\jsonapi\Context

Code

protected static function getPathPartPropertyName($part) {
  return strpos($part, ':') !== FALSE ? explode(':', $part)[0] : $part;
}