Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fillpdf
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
fillpdf
Commits
cd2ebdf7
Commit
cd2ebdf7
authored
2 years ago
by
Liam Morland
Browse files
Options
Downloads
Patches
Plain Diff
Issue #3280433: Create hook_fillpdf_form_form_pre_alter()
parent
f87b6c59
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fillpdf.api.php
+19
-0
19 additions, 0 deletions
fillpdf.api.php
src/Form/FillPdfFormForm.php
+3
-0
3 additions, 0 deletions
src/Form/FillPdfFormForm.php
with
22 additions
and
0 deletions
fillpdf.api.php
+
19
−
0
View file @
cd2ebdf7
...
...
@@ -5,11 +5,30 @@
* Hooks related to FillPDF module.
*/
use
Drupal\fillpdf\Form\FillPdfFormForm
;
/**
* @addtogroup hooks
* @{
*/
/**
* Alter a FillPdfFormForm prior to building its edit form.
*
* This is triggered in FillPdfFormForm::form().
*
* @param Drupal\fillpdf\Form\FillPdfFormForm $fillpdf_form_form
* The FillPdfFormForm object to alter.
*/
function
hook_fillpdf_form_form_pre_form_build_alter
(
FillPdfFormForm
$fillpdf_form_form
):
void
{
// Set the default entity type for any FillPDF form to 'webform'.
$fillpdf_form
=
$fillpdf_form_form
->
getEntity
();
$default_entity_type
=
$fillpdf_form
->
getDefaultEntityType
();
if
(
!
$default_entity_type
)
{
$fillpdf_form
->
set
(
'default_entity_type'
,
'webform'
)
->
save
();
}
}
/**
* Alter the $context in HandlePdfController::populatePdf().
*
...
...
This diff is collapsed.
Click to expand it.
src/Form/FillPdfFormForm.php
+
3
−
0
View file @
cd2ebdf7
...
...
@@ -144,6 +144,9 @@ class FillPdfFormForm extends ContentEntityForm {
* {@inheritdoc}
*/
public
function
form
(
array
$form
,
FormStateInterface
$form_state
)
{
// Create hook_fillpdf_form_form_pre_form_build_alter().
$this
->
moduleHandler
->
alter
(
'fillpdf_form_form_pre_form_build'
,
$this
);
$form
=
parent
::
form
(
$form
,
$form_state
);
/** @var \Drupal\fillpdf\FillPdfFormInterface $fillpdf_form */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment