Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panels_breadcrumbs
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
panels_breadcrumbs
Commits
56c9be6c
Commit
56c9be6c
authored
10 months ago
by
Viktor Holovachek
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3441454
- Fix phpstan
parent
46a9fd44
No related branches found
No related tags found
1 merge request
!7
Issue #3441454 - Fix phpstan
Pipeline
#148942
passed with warnings
10 months ago
Stage: build
Stage: validate
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
phpstan.neon
+11
-0
11 additions, 0 deletions
phpstan.neon
src/Form/PageVariantBreadcrumbsForm.php
+32
-4
32 additions, 4 deletions
src/Form/PageVariantBreadcrumbsForm.php
with
43 additions
and
4 deletions
phpstan.neon
0 → 100644
+
11
−
0
View file @
56c9be6c
# Configuration file for PHPStan static code checking.
# @see: https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/phpstan.neon.dist
parameters:
level: 1
ignoreErrors:
# new static() is a best practice in Drupal, so we cannot fix that.
# @see https://www.drupal.org/docs/develop/development-tools/phpstan/handling-unsafe-usage-of-new-static
- "#^Unsafe usage of new static#"
This diff is collapsed.
Click to expand it.
src/Form/PageVariantBreadcrumbsForm.php
+
32
−
4
View file @
56c9be6c
...
...
@@ -3,8 +3,10 @@
namespace
Drupal\panels_breadcrumbs\Form
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Config\ConfigFactory
;
use
Drupal\Core\Form\FormBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Class PageVariantBreadcrumbsForm.
...
...
@@ -13,6 +15,32 @@ class PageVariantBreadcrumbsForm extends FormBase {
use
PageBreadcrumbsFormTrait
;
/**
* Returns the config.factory service.
*
* @var \Drupal\Core\Config\ConfigFactory
*/
protected
$config
;
/**
* Constructs a PageVariantBreadcrumbsForm form.
*
* @param \Drupal\Core\Config\ConfigFactory $config
* Defines the configuration object factory.
*/
public
function
__construct
(
ConfigFactory
$config
)
{
$this
->
config
=
$config
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'config.factory'
)
);
}
/**
* {@inheritdoc}
*/
...
...
@@ -55,7 +83,7 @@ class PageVariantBreadcrumbsForm extends FormBase {
$form
[
'home_text'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'Home link title'
),
'#description'
=>
$this
->
t
(
'Text will be displayed as Home link title in the breadcrumb'
),
'#description'
=>
$this
->
t
(
'Text will be displayed as Home link title in the breadcrumb
.
'
),
'#default_value'
=>
isset
(
$breadcrumbs_settings
[
'home_text'
])
?
$breadcrumbs_settings
[
'home_text'
]
:
$this
->
t
(
'Home'
),
'#states'
=>
[
'visible'
=>
[
...
...
@@ -63,7 +91,7 @@ class PageVariantBreadcrumbsForm extends FormBase {
],
],
];
if
(
$token_types
=
$this
->
getTypesOfTokens
(
$page_variant
))
{
if
(
$token_types
=
self
::
getTypesOfTokens
(
$page_variant
))
{
$form
[
'tokens'
]
=
[
'#theme'
=>
'token_tree_link'
,
'#token_types'
=>
$token_types
,
...
...
@@ -85,13 +113,13 @@ class PageVariantBreadcrumbsForm extends FormBase {
$variant_settings
=
$page_variant
->
get
(
'variant_settings'
);
$submitted_values
=
$form_state
->
getValues
();
foreach
(
$this
->
getSettingsKeys
()
as
$name
)
{
foreach
(
self
::
getSettingsKeys
()
as
$name
)
{
$variant_settings
[
'panels_breadcrumbs'
][
$name
]
=
$submitted_values
[
$name
];
}
$page_variant
->
set
(
'variant_settings'
,
$variant_settings
);
// Invalidate breadcrumbs block cache.
$theme_name
=
\Drupal
::
config
(
'system.theme'
)
->
get
(
'default'
);
$theme_name
=
$this
->
config
->
get
(
'system.theme'
)
->
get
(
'default'
);
Cache
::
invalidateTags
([
"config:block.block.
{
$theme_name
}
_breadcrumbs"
]);
}
...
...
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