Skip to content
Snippets Groups Projects
Commit 1cc910e7 authored by Bas Vredeling's avatar Bas Vredeling
Browse files

git commit -m 'Issue #3424944: Support for PHP 8.3'

parent e78ef343
Branches
Tags
No related merge requests found
......@@ -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)
......
......@@ -22,7 +22,7 @@ class ParagraphBlocksDeriver extends EntityDeriverBase {
*
* @var int
*/
protected $maxCardinality;
protected int $maxCardinality;
/**
* Constructs a new ParagraphBlocksDeriver instance.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment