Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
config_enforce_devel
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
config_enforce_devel
Commits
ae332b49
Commit
ae332b49
authored
2 years ago
by
ambient.impact
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3361318
: Fixes TargetModuleBuilder fatal error on Drupal 10.
parent
0c0d658a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!22
Issue #3361318: Fixes TargetModuleBuilder fatal error on Drupal 10.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TargetModuleBuilder.php
+22
-8
22 additions, 8 deletions
src/TargetModuleBuilder.php
with
22 additions
and
8 deletions
src/TargetModuleBuilder.php
+
22
−
8
View file @
ae332b49
...
...
@@ -8,6 +8,7 @@ use Drupal\config_enforce\ConfigEnforceHelperTrait;
use
Drupal\Core\Config\InstallStorage
;
use
Drupal\Core\Extension\MissingDependencyException
;
use
Drupal\Core\File\FileSystemInterface
;
use
Drupal\Core\Render\RendererInterface
;
use
Drupal\Core\StringTranslation\TranslatableMarkup
;
use
Drupal\Core\Url
;
use
Drupal\config_enforce
\ConfigEnforcer
;
...
...
@@ -37,11 +38,19 @@ class TargetModuleBuilder {
// An instance of the Drupal file system service.
protected
$fileSystem
;
/**
* The Drupal renderer service.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected
RendererInterface
$renderer
;
/**
* A basic constructor method.
*/
public
function
__construct
()
{
$this
->
fileSystem
=
\Drupal
::
service
(
'file_system'
);
$this
->
renderer
=
\Drupal
::
service
(
'renderer'
);
}
/**
...
...
@@ -313,15 +322,20 @@ class TargetModuleBuilder {
*/
protected
function
getInfoFileContents
()
{
$template
=
\Drupal
::
service
(
'extension.list.module'
)
->
getPath
(
'config_enforce_devel'
)
.
'/templates/info.yml.twig'
;
// Cast to string since twig_render_template returns a Markup object.
return
(
string
)
\Drupal
::
service
(
'twig'
)
->
loadTemplate
(
$template
)
->
render
([
'name'
=>
$this
->
getName
(),
/** @var array Render array for the extension .info.yml contents. */
$renderArray
=
[
'#type'
=>
'inline_template'
,
'#template'
=>
\file_get_contents
(
$template
),
'#context'
=>
[
'name'
=>
$this
->
getName
(),
'description'
=>
$this
->
getDescription
(),
// Needed to prevent notices when Twig debugging is enabled.
'theme_hook_original'
=>
'not-applicable'
,
]);
],
];
// Cast to a string since this an object implementing
// \Drupal\Component\Render\MarkupInterface
return
(
string
)
$this
->
renderer
->
renderPlain
(
$renderArray
);
}
}
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