You are here

final public function PartyDataBase::getDataInfo in Party 8.2

Get information from the data set or entity definition.

@todo: Work out if this is depricated, in favour of drupal_container()->get('plugin.manager.partydata')->getDefinition().

Parameters

string $key: This is the information you want:

  • 'type': the data set entity type.
  • 'bundle': the data set entity bundle.
  • 'id key': the entity id key.
  • 'bundle key': the entity bundle key.
3 calls to PartyDataBase::getDataInfo()
PartyDataBase::createEntity in lib/Drupal/party/Plugin/PartyDataBase.php
Create a new entity
PartyDataBase::save in lib/Drupal/party/Plugin/PartyDataBase.php
Save the attached entities information
PartyDataBase::__construct in lib/Drupal/party/Plugin/PartyDataBase.php
Constructor

File

lib/Drupal/party/Plugin/PartyDataBase.php, line 115
Contains \Drupal\party\Plugin\PartyDataBase.

Class

PartyDataBase
Class PartyDataBase

Namespace

Drupal\party\Plugin

Code

public final function getDataInfo($key) {
  $entity_info = drupal_container()
    ->get('plugin.manager.entity')
    ->getDefinition($this->dataConfig['entity type']);

  // Return the relevant information
  switch ($key) {

    // Data Set Info
    case 'name':
      return $this->dataName;
    case 'path element':
      return $this->dataConfig['path element'];
    case 'label':
      return $this->dataConfig['label'];
    case 'entity type':
      return $this->dataConfig['entity type'];
    case 'entity bundle':
      return $this->dataConfig['entity bundle'];

    // entity Info
    case 'id key':
      return $entity_info['entity keys']['id'];
    case 'bundle key':
      return $entity_info['entity keys']['bundle'];
  }
}