Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
require_on_publish
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
require_on_publish
Merge requests
!2
Issue
#3317126
: Undefined array key "#paragraph_type"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3317126
: Undefined array key "#paragraph_type"
issue/require_on_publish-3317126:3317126-undefined-array-key
into
8.x-1.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Arthur Baghdasaryan
requested to merge
issue/require_on_publish-3317126:3317126-undefined-array-key
into
8.x-1.x
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
8.x-1.x
8.x-1.x (HEAD)
and
latest version
latest version
c4816c87
1 commit,
2 years ago
1 file
+
12
−
11
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
require_on_publish.module
+
12
−
11
Options
@@ -194,17 +194,18 @@ function require_on_publish_field_widget_single_element_paragraphs_form_alter(ar
* Helper function that adds an indicator to paragraph elements.
*/
function
_require_on_publish_add_indicator_to_paragraph
(
&
$element
,
FormStateInterface
$form_state
,
$context
)
{
$paragraph_type
=
$element
[
'#paragraph_type'
];
$fields
=
\Drupal
::
service
(
'entity_field.manager'
)
->
getFieldDefinitions
(
'paragraph'
,
$paragraph_type
);
foreach
(
$fields
as
$field_config
)
{
if
(
!
(
$field_config
instanceof
FieldConfigInterface
))
{
continue
;
}
if
(
$field_config
->
getThirdPartySetting
(
'require_on_publish'
,
'require_on_publish'
,
FALSE
))
{
$field_name
=
$field_config
->
getName
();
$element
[
'#attached'
][
'library'
][]
=
'require_on_publish/require_on_publish'
;
if
(
isset
(
$element
[
'subform'
][
$field_name
][
'widget'
]))
{
require_on_publish_add_indicator
(
$element
[
'subform'
][
$field_name
][
'widget'
]);
if
(
$paragraph_type
=
$element
[
'#paragraph_type'
])
{
$fields
=
\Drupal
::
service
(
'entity_field.manager'
)
->
getFieldDefinitions
(
'paragraph'
,
$paragraph_type
);
foreach
(
$fields
as
$field_config
)
{
if
(
!
(
$field_config
instanceof
FieldConfigInterface
))
{
continue
;
}
if
(
$field_config
->
getThirdPartySetting
(
'require_on_publish'
,
'require_on_publish'
,
FALSE
))
{
$field_name
=
$field_config
->
getName
();
$element
[
'#attached'
][
'library'
][]
=
'require_on_publish/require_on_publish'
;
if
(
isset
(
$element
[
'subform'
][
$field_name
][
'widget'
]))
{
require_on_publish_add_indicator
(
$element
[
'subform'
][
$field_name
][
'widget'
]);
}
}
}
}
Loading