Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
documentation_generator
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
documentation_generator
Commits
afe70d4c
There was an error fetching the commit references. Please try again later.
Commit
afe70d4c
authored
2 years ago
by
Project Update Bot
Committed by
Gaurav Kapoor
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3296971
by Project Update Bot: Automated Drupal 10 compatibility fixes
parent
4f6609cb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
documentation_generator.info.yml
+1
-1
1 addition, 1 deletion
documentation_generator.info.yml
src/Plugin/DocumentationGeneratorRender/PDF.php
+30
-6
30 additions, 6 deletions
src/Plugin/DocumentationGeneratorRender/PDF.php
with
31 additions
and
7 deletions
documentation_generator.info.yml
+
1
−
1
View file @
afe70d4c
name
:
Documentation generator
description
:
Allows administrators to generate documentation describing site features.
type
:
module
core_version_requirement
:
^
8.8
|| ^
9
core_version_requirement
:
^
9.3
|| ^
10
This diff is collapsed.
Click to expand it.
src/Plugin/DocumentationGeneratorRender/PDF.php
+
30
−
6
View file @
afe70d4c
...
...
@@ -4,7 +4,9 @@ namespace Drupal\documentation_generator\Plugin\DocumentationGeneratorRender;
use
Dompdf\Dompdf
;
use
Drupal\Core\File\Exception\FileException
;
use
Drupal\file\FileRepositoryInterface
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\Core\Render\RendererInterface
;
use
Drupal\documentation_generator
\Plugin\DocumentationGeneratorRenderBase
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -21,12 +23,26 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class
PDF
extends
DocumentationGeneratorRenderBase
implements
ContainerFactoryPluginInterface
{
/**
* The mpdf.
* The
do
mpdf.
*
* @var \Dompdf\Dompdf
*/
protected
$dompdf
;
/**
* The form builder.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected
$renderer
;
/**
* The file repository.
*
* @var \Drupal\file\FileRepositoryInterface
*/
protected
$fileRepository
;
/**
* Constructs a new PDF instance.
*
...
...
@@ -37,12 +53,18 @@ class PDF extends DocumentationGeneratorRenderBase implements ContainerFactoryPl
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Dompdf\Dompdf $dompdf
* The mpdf.
* The dompdf.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
* @param \Drupal\file\FileRepositoryInterface $file_repository
* The file repository.
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
Dompdf
$dompdf
)
{
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
Dompdf
$dompdf
,
RendererInterface
$renderer
,
FileRepositoryInterface
$file_repository
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
dompdf
=
$dompdf
;
$this
->
renderer
=
$renderer
;
$this
->
fileRepository
=
$file_repository
;
}
/**
...
...
@@ -53,7 +75,9 @@ class PDF extends DocumentationGeneratorRenderBase implements ContainerFactoryPl
$configuration
,
$plugin_id
,
$plugin_definition
,
$container
->
get
(
'documentation_generator.dompdf'
)
$container
->
get
(
'documentation_generator.dompdf'
),
$container
->
get
(
'renderer'
),
$container
->
get
(
'file.repository'
)
);
}
...
...
@@ -74,13 +98,13 @@ class PDF extends DocumentationGeneratorRenderBase implements ContainerFactoryPl
'#groups'
=>
$groups
,
];
$this
->
dompdf
->
loadHtml
(
render
(
$build
));
$this
->
dompdf
->
loadHtml
(
$this
->
renderer
->
render
(
$build
));
$this
->
dompdf
->
render
();
$output
=
$this
->
dompdf
->
output
();
$success
=
TRUE
;
try
{
file_save_d
ata
(
$output
,
'private://'
.
$fileName
);
$this
->
fileRepository
->
writeD
ata
(
$output
,
'private://'
.
$fileName
);
}
catch
(
FileException
$e
)
{
$success
=
FALSE
;
...
...
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