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

Breadcrumb

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

function EntityBase::uriRelationships

Overrides EntityInterface::uriRelationships

File

core/lib/Drupal/Core/Entity/EntityBase.php, line 299

Class

EntityBase
Defines a base entity class.

Namespace

Drupal\Core\Entity

Code

public function uriRelationships() {
    return array_filter(array_keys($this->linkTemplates()), function ($link_relation_type) {
        // It's not guaranteed that every link relation type also has a
        // corresponding route. For some, additional modules or configuration may
        // be necessary. The interface demands that we only return supported URI
        // relationships.
        try {
            $this->toUrl($link_relation_type)
                ->toString(TRUE)
                ->getGeneratedUrl();
        } catch (RouteNotFoundException) {
            return FALSE;
        } catch (MissingMandatoryParametersException) {
            return FALSE;
        }
        return TRUE;
    });
}

API Navigation

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