public function CertificateController::viewEntity in Opigno certificate 8
Same name and namespace in other branches
- 3.x src/Controller/CertificateController.php \Drupal\opigno_certificate\Controller\CertificateController::viewEntity()
Callback to view the opigno_certificate entity attached to any entity.
1 string reference to 'CertificateController::viewEntity'
File
- src/
Controller/ CertificateController.php, line 54
Class
- CertificateController
- Defines a controller to render a single opigno_certificate.
Namespace
Drupal\opigno_certificate\ControllerCode
public function viewEntity($entity_type, $entity_id, $view_mode = 'full') {
$entity = $this->entityManager
->getStorage($entity_type)
->load($entity_id);
/** @var \Drupal\opigno_certificate\OpignoCertificateInterface $opigno_certificate */
$opigno_certificate = $entity->field_certificate->entity;
// We're going to render the opigno_certificate,
// but the opigno_certificate will need pull
// information from the entity that references it. So set the
// 'referencing_entity' computed field to the entity being displayed.
$opigno_certificate
->set('referencing_entity', $entity);
return $this
->view($opigno_certificate, $view_mode);
}