public function PartyDataBase::loadEntities in Party 8.2
Load the full entities.
Parameters
array|null $deltas: (optional) An array of delta(s) to load or NULL to load all entities.
Return value
$this
2 calls to PartyDataBase::loadEntities()
- PartyDataBase::getEntities in lib/
Drupal/ party/ Plugin/ PartyDataBase.php - Get all attached entities
- PartyDataBase::getEntity in lib/
Drupal/ party/ Plugin/ PartyDataBase.php - Get a particular attached entity
File
- lib/
Drupal/ party/ Plugin/ PartyDataBase.php, line 179 - Contains \Drupal\party\Plugin\PartyDataBase.
Class
- PartyDataBase
- Class PartyDataBase
Namespace
Drupal\party\PluginCode
public function loadEntities($deltas = NULL) {
// Get our array of deltas
if ($deltas === NULL) {
// Load all entities
$deltas = array_keys($this->entities);
}
// Iterate over our deltas loading our entities if required.
foreach ($deltas as $delta) {
if (isset($this->entities[$delta]) && isset($this->entities[$delta]->is_stub)) {
// This entity is a stub so needs loading. First get the entity id from
// stub entity.
$entity_id = $this->entities[$delta]->id;
$entities_loaded = drupal_container()
->get('plugin.manager.entity')
->getStorageController($this
->getDataInfo('entity type'))
->load(array(
$entity_id,
));
$this->entities[$delta] = reset($entities_loaded);
// Add the other properties party needs.
$this->entities[$delta]->data_set_name = $this->dataName;
$this->entities[$delta]->party_attaching_party = $this->party
->id();
}
}
return $this;
}