Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
paragraph_blocks
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
paragraph_blocks
Commits
1cc910e7
Commit
1cc910e7
authored
11 months ago
by
Bas Vredeling
Browse files
Options
Downloads
Patches
Plain Diff
git commit -m 'Issue
#3424944
: Support for PHP 8.3'
parent
e78ef343
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ParagraphBlocksEntityPresaveHelper.php
+19
-15
19 additions, 15 deletions
src/ParagraphBlocksEntityPresaveHelper.php
src/Plugin/Deriver/ParagraphBlocksDeriver.php
+1
-1
1 addition, 1 deletion
src/Plugin/Deriver/ParagraphBlocksDeriver.php
with
20 additions
and
16 deletions
src/ParagraphBlocksEntityPresaveHelper.php
+
19
−
15
View file @
1cc910e7
...
...
@@ -7,6 +7,7 @@ use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use
Drupal\Core\TempStore\PrivateTempStore
;
use
Drupal\Core\TempStore\PrivateTempStoreFactory
;
use
Drupal\Core\TempStore\TempStoreException
;
use
Drupal\layout_builder
\SectionListInterface
;
/**
* The entity presave helper.
...
...
@@ -48,6 +49,13 @@ class ParagraphBlocksEntityPresaveHelper {
*/
private
EntityInterface
$entity
;
/**
* Layout builder section item list.
*
* @var \Drupal\layout_builder\SectionListInterface $layout
*/
private
SectionListInterface
$layout
;
/**
* Constructs a ParagraphBlocksEntityPresaveHelper object.
*
...
...
@@ -75,7 +83,7 @@ class ParagraphBlocksEntityPresaveHelper {
public
function
setEntity
(
EntityInterface
$entity
):
void
{
$this
->
entity
=
$entity
;
$this
->
tempStoreKey
=
$entity
->
bundle
()
.
'.'
.
$entity
->
id
()
.
'.'
.
$entity
->
language
()
->
getId
();
->
getId
();
$this
->
layout
=
$this
->
entity
->
get
(
'layout_builder__layout'
);
}
...
...
@@ -142,7 +150,7 @@ class ParagraphBlocksEntityPresaveHelper {
// Collect the paragraph ids of the new entity.
foreach
(
$this
->
entity
->
getFields
()
as
$fieldKey
=>
$field
)
{
if
(
method_exists
(
$field
->
getFieldDefinition
(),
'getThirdPartySetting'
)
&&
$field
->
getFieldDefinition
()
->
getThirdPartySetting
(
'paragraph_blocks'
,
'status'
))
{
->
getThirdPartySetting
(
'paragraph_blocks'
,
'status'
))
{
foreach
(
$this
->
entity
->
get
(
$fieldKey
)
->
getIterator
()
as
$item
)
{
$new_paragraph_ids
[]
=
$item
->
getValue
()[
'target_id'
];
...
...
@@ -191,7 +199,7 @@ class ParagraphBlocksEntityPresaveHelper {
$fields
=
[];
foreach
(
$this
->
entity
->
getFields
()
as
$key
=>
$field
)
{
if
(
method_exists
(
$field
->
getFieldDefinition
(),
'getThirdPartySetting'
)
&&
$field
->
getFieldDefinition
()
->
getThirdPartySetting
(
'paragraph_blocks'
,
'status'
))
{
->
getThirdPartySetting
(
'paragraph_blocks'
,
'status'
))
{
$fields
[]
=
$key
;
}
}
...
...
@@ -303,9 +311,9 @@ class ParagraphBlocksEntityPresaveHelper {
if
(
!
empty
(
$deltas_reordered
))
{
foreach
(
$deltas_reordered
as
$delta_to
=>
$delta_from
)
{
$delta_old
=
'paragraph_field:'
.
$this
->
entity
->
getEntityType
()
->
id
()
.
':'
.
$field
.
':'
.
$delta_from
.
':'
.
$this
->
entity
->
bundle
();
->
id
()
.
':'
.
$field
.
':'
.
$delta_from
.
':'
.
$this
->
entity
->
bundle
();
$delta_new
=
'paragraph_field:'
.
$this
->
entity
->
getEntityType
()
->
id
()
.
':'
.
$field
.
':'
.
$delta_to
.
':'
.
$this
->
entity
->
bundle
();
->
id
()
.
':'
.
$field
.
':'
.
$delta_to
.
':'
.
$this
->
entity
->
bundle
();
// Collect the required paragraph delta updates.
if
(
$configuration
[
'id'
]
==
$delta_old
)
{
...
...
@@ -326,12 +334,10 @@ class ParagraphBlocksEntityPresaveHelper {
* The values of delta to update.
*/
private
function
performLayoutBuilderDeltaUpdates
(
array
$delta_updates
):
void
{
foreach
(
$delta_updates
as
[
'section_index'
=>
$section_index
,
foreach
(
$delta_updates
as
[
'section_index'
=>
$section_index
,
'component_index'
=>
$component_index
,
'configuration_id'
=>
$configuration_id
,
]
)
{
'configuration_id'
=>
$configuration_id
,]
)
{
$configuration
=
$this
->
layout
->
getIterator
()
->
offsetGet
(
$section_index
)
...
...
@@ -365,7 +371,7 @@ class ParagraphBlocksEntityPresaveHelper {
private
function
prepareLayoutBuilderDeltaDeletes
(
array
&
$delta_deletes
,
array
$deltas_deleted
,
$field
,
array
$configuration
,
$section_index
,
$component_index
,
string
$component_uuid
):
void
{
foreach
(
$deltas_deleted
as
$delta
)
{
$delta_old
=
'paragraph_field:'
.
$this
->
entity
->
getEntityType
()
->
id
()
.
':'
.
$field
.
':'
.
$delta
.
':'
.
$this
->
entity
->
bundle
();
->
id
()
.
':'
.
$field
.
':'
.
$delta
.
':'
.
$this
->
entity
->
bundle
();
// Collect the required paragraph delta updates.
if
(
$configuration
[
'id'
]
==
$delta_old
)
{
...
...
@@ -385,11 +391,9 @@ class ParagraphBlocksEntityPresaveHelper {
* The values of delta to be deleted.
*/
private
function
performLayoutBuilderDeltaDeletes
(
array
$delta_deletes
):
void
{
foreach
(
$delta_deletes
as
[
'section_index'
=>
$section_index
,
foreach
(
$delta_deletes
as
[
'section_index'
=>
$section_index
,
'component_index'
=>
$component_index
,
'component_uuid'
=>
$component_uuid
,
])
{
'component_uuid'
=>
$component_uuid
])
{
$this
->
layout
->
getIterator
()
->
offsetGet
(
$section_index
)
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/Deriver/ParagraphBlocksDeriver.php
+
1
−
1
View file @
1cc910e7
...
...
@@ -22,7 +22,7 @@ class ParagraphBlocksDeriver extends EntityDeriverBase {
*
* @var int
*/
protected
$maxCardinality
;
protected
int
$maxCardinality
;
/**
* Constructs a new ParagraphBlocksDeriver instance.
...
...
This diff is collapsed.
Click to expand it.
Bas Vredeling
@basvredeling
mentioned in merge request
!14 (closed)
·
11 months ago
mentioned in merge request
!14 (closed)
mentioned in merge request !14
Toggle commit list
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