public function EntityPrintController::viewPrintDebug in Opigno certificate 8
Same name and namespace in other branches
- 3.x src/Controller/EntityPrintController.php \Drupal\opigno_certificate\Controller\EntityPrintController::viewPrintDebug()
A debug callback for styling up the Print.
Parameters
string $entity_type: The entity type.
string $entity_id: The entity ID.
Return value
\Symfony\Component\HttpFoundation\Response The response object.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- src/
Controller/ EntityPrintController.php, line 120
Class
- EntityPrintController
- Print controller.
Namespace
Drupal\opigno_certificate\ControllerCode
public function viewPrintDebug($entity_type, $entity_id) {
$entity = $this->entityTypeManager
->getStorage($entity_type)
->load($entity_id);
$opigno_certificate = $entity->field_opigno_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);
$use_default_css = $this
->config('entity_print.settings')
->get('default_css');
return new Response($this->printBuilder
->printHtml($opigno_certificate, $use_default_css, FALSE));
}