protected function DemoContent::loadByUuid in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.2 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.3 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.4 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.6 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.7 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 8.8 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 10.3.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 10.0.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 10.1.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
- 10.2.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::loadByUuid()
Load entity by uuid.
Parameters
string $entity_type_id: Identifier of entity type.
string|int $id: Identifier or uuid.
bool $all: If set true, method will return all loaded entity. If set false, will return only one.
Return value
\Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\EntityInterface[]|mixed Returns the entity.
7 calls to DemoContent::loadByUuid()
- DemoComment::createContent in modules/
custom/ social_demo/ src/ DemoComment.php - Creates content.
- DemoContent::checkMentionOrLinkByUuid in modules/
custom/ social_demo/ src/ DemoContent.php - Extract the mention from the content by [~Uuid].
- DemoContent::prepareImage in modules/
custom/ social_demo/ src/ DemoContent.php - Prepares data about an image.
- DemoGroup::createContent in modules/
custom/ social_demo/ src/ DemoGroup.php - Creates content.
- DemoNode::createContent in modules/
custom/ social_demo/ src/ DemoNode.php - Creates content.
File
- modules/
custom/ social_demo/ src/ DemoContent.php, line 146
Class
- DemoContent
- Class DemoContent.
Namespace
Drupal\social_demoCode
protected function loadByUuid($entity_type_id, $id, $all = FALSE) {
if (property_exists($this, $entity_type_id . 'Storage')) {
$storage = $this->{$entity_type_id . 'Storage'};
}
else {
$storage = \Drupal::entityTypeManager()
->getStorage($entity_type_id);
}
if (is_numeric($id)) {
$entities = $storage
->loadByProperties([
'uid' => $id,
]);
}
else {
$entities = $storage
->loadByProperties([
'uuid' => $id,
]);
}
if (!$all) {
return current($entities);
}
return $entities;
}