Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldResolver.php

function 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 core/modules/jsonapi/src/Context/FieldResolver.php
Determines if a path part targets a field property, not a subsequent field.
FieldResolver::isCandidateDefinitionReferenceProperty in core/modules/jsonapi/src/Context/FieldResolver.php
Determines if a path part targets a reference property.

File

core/modules/jsonapi/src/Context/FieldResolver.php, line 739

Class

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

Namespace

Drupal\jsonapi\Context

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal