Skip to content
Snippets Groups Projects
Commit bfef2b1f authored by Liam Morland's avatar Liam Morland
Browse files

Issue #3274842: Create hook_fillpdf_populate_pdf_context_alter()

parent e43e2c0d
No related branches found
No related tags found
No related merge requests found
...@@ -162,6 +162,18 @@ class HandlePdfController extends ControllerBase { ...@@ -162,6 +162,18 @@ class HandlePdfController extends ControllerBase {
); );
} }
/**
* Trigger hook that allows modules to alter $context().
*
* Creates hook_fillpdf_populate_pdf_context_alter().
*
* @param array $context
* The FillPDF context to alter.
*/
public function alterContext(array &$context): void {
$this->moduleHandler()->alter('fillpdf_populate_pdf_context', $context);
}
/** /**
* Populates PDF template from context. * Populates PDF template from context.
* *
...@@ -177,9 +189,8 @@ class HandlePdfController extends ControllerBase { ...@@ -177,9 +189,8 @@ class HandlePdfController extends ControllerBase {
public function populatePdf() { public function populatePdf() {
$context = $this->linkManipulator->parseRequest($this->requestStack->getCurrentRequest()); $context = $this->linkManipulator->parseRequest($this->requestStack->getCurrentRequest());
// Create hook_fillpdf_populate_pdf_context_alter(). // Trigger hook_fillpdf_populate_pdf_context_alter().
// Allow modules to alter $context. $this->alterContext($context);
$this->moduleHandler()->alter('fillpdf_populate_pdf_context', $context);
$fillpdf_form = FillPdfForm::load($context['fid']); $fillpdf_form = FillPdfForm::load($context['fid']);
$entities = $this->contextManager->loadEntities($context); $entities = $this->contextManager->loadEntities($context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment