You are here

class RelationLinkManager in Default Content 8

Hierarchy

Expanded class hierarchy of RelationLinkManager

File

src/LinkManager/RelationLinkManager.php, line 12
Contains \Drupal\defaultcontent\LinkManager\RelationLinkManager.

Namespace

Drupal\defaultcontent\LinkManager
View source
class RelationLinkManager extends RestRelationLinkManager {

  /**
   * {@inheritdoc}
   */
  public function getRelationUri($entity_type, $bundle, $field_name) {

    // Make the base path refer to drupal.org.x`
    return "http://drupal.org/rest/relation/{$entity_type}/{$bundle}/{$field_name}";
  }

  /**
   * {@inheritdoc}
   */
  protected function writeCache() {
    $data = array();
    foreach ($this->entityManager
      ->getDefinitions() as $entity_type_id => $entity_type) {
      $reflection = new \ReflectionClass($entity_type
        ->getClass());

      // We are only interested in importing content entities.
      if ($reflection
        ->implementsInterface('\\Drupal\\Core\\Config\\Entity\\ConfigEntityInterface') || !$reflection
        ->hasMethod('baseFieldDefinitions')) {
        continue;
      }
      foreach (array_keys($this->entityManager
        ->getBundleInfo($entity_type_id)) as $bundle) {
        foreach ($this->entityManager
          ->getFieldDefinitions($entity_type_id, $bundle) as $field_name => $field_details) {
          $relation_uri = $this
            ->getRelationUri($entity_type_id, $bundle, $field_name);
          $data[$relation_uri] = array(
            'entity_type' => $entity_type_id,
            'bundle' => $bundle,
            'field_name' => $field_name,
          );
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeprecatedServicePropertyTrait::__get public function Allows to access deprecated/removed properties.
LinkManagerBase::$configFactory protected property Config factory service.
LinkManagerBase::$linkDomain protected property Link domain used for type links URIs.
LinkManagerBase::$requestStack protected property The request stack.
LinkManagerBase::getLinkDomain protected function Gets the link domain.
LinkManagerBase::setLinkDomain public function
RelationLinkManager::$cache protected property
RelationLinkManager::$deprecatedProperties protected property
RelationLinkManager::$entityFieldManager protected property The entity field manager.
RelationLinkManager::$entityTypeBundleInfo protected property The entity bundle info.
RelationLinkManager::$entityTypeManager protected property The entity type manager.
RelationLinkManager::$moduleHandler protected property Module handler service.
RelationLinkManager::getRelationInternalIds public function Translates a REST URI into internal IDs. Overrides RelationLinkManagerInterface::getRelationInternalIds
RelationLinkManager::getRelations protected function Get the array of relation links.
RelationLinkManager::getRelationUri public function Gets the URI that corresponds to a field. Overrides RelationLinkManager::getRelationUri
RelationLinkManager::writeCache protected function Writes the cache of relation links. Overrides RelationLinkManager::writeCache
RelationLinkManager::__construct public function Constructor.