Commit 99dd03c9 authored by Yahya Al Hamad's avatar Yahya Al Hamad Committed by Yahya Al Hamad
Browse files

Issue #3283107 by YahyaAlHamad: $uuid must be of type Drupal\Component\Uuid\Php

parent 4a4eb90e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

namespace Drupal\seeds_layouts\Form;

use Drupal\Component\Uuid\Php;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Form\ConfigFormBase;
@@ -40,7 +40,7 @@ class ColumnsForm extends ConfigFormBase {
  /**
   * Uuid instance.
   *
   * @var \Drupal\Component\Uuid\Php
   * @var \Drupal\Component\Uuid\UuidInterface
   */
  protected $uuid;

@@ -61,7 +61,7 @@ class ColumnsForm extends ConfigFormBase {
    EntityTypeManager $entity_type_manager,
    SeedsLayoutsManager $seeds_layouts_manager,
    FormBuilder $form_builder,
    Php $uuid
    UuidInterface $uuid
  ) {
    parent::__construct($config_factory);
    $this->entityTypeManager = $entity_type_manager;
+8 −6
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace Drupal\seeds_layouts\Form;

use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Uuid\Php;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Form\ConfigFormBase;
@@ -49,7 +49,7 @@ class SeedsLayoutsConfigForm extends ConfigFormBase {
  /**
   * Uuid instance.
   *
   * @var \Drupal\Component\Uuid\Php
   * @var \Drupal\Component\Uuid\UuidInterface
   */
  protected $uuid;

@@ -71,7 +71,7 @@ class SeedsLayoutsConfigForm extends ConfigFormBase {
    LayoutFieldManager $layout_field_manager,
    SeedsLayoutsManager $seeds_layouts_manager,
    FormBuilder $form_builder,
    Php $uuid
    UuidInterface $uuid
  ) {
    parent::__construct($config_factory);
    $this->entityTypeManager = $entity_type_manager;
@@ -196,7 +196,8 @@ class SeedsLayoutsConfigForm extends ConfigFormBase {
      // Setup field config.
      if (!empty($form_state->getUserInput()['layout_fields'][$uuid])) {
        $layout_field = $form_state->getUserInput()['layout_fields'][$uuid];
      } else {
      }
      else {
        $layout_field = @$config->get('layout_fields')[$uuid];
      }

@@ -241,7 +242,8 @@ class SeedsLayoutsConfigForm extends ConfigFormBase {
        /** @var \Drupal\seeds_layouts\Plugin\LayoutF ieldInterface $layout_field_instance */
        try {
          $layout_field_instance = $this->layoutFieldManager->createInstance($type, $layout_field_config);
        } catch (PluginNotFoundException $e) {
        }
        catch (PluginNotFoundException $e) {
          $this->messenger()->addError($e->getMessage());
          continue;
        }
@@ -254,7 +256,7 @@ class SeedsLayoutsConfigForm extends ConfigFormBase {
        $layout_field = $layout_field_instance->buildConfigurationForm($layout_field, $form_state);
      }

      $weight = isset($layout_field['weight']) ? $layout_field['weight'] : 0;
      $weight = $layout_field['weight'] ?? 0;
      // Add the field to the wrapper.
      $layout_fields_wrapper[$uuid] = [
        '#weight' => $weight,
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

namespace Drupal\seeds_layouts;

use Drupal\Component\Uuid\Php;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\FileStorage;
use Drupal\Core\Entity\EntityTypeManager;
@@ -37,14 +37,14 @@ class SeedsLayoutsManager {
  /**
   * Uuid instance.
   *
   * @var \Drupal\Component\Uuid\Php
   * @var \Drupal\Component\Uuid\UuidInterface
   */
  protected $uuid;

  /**
   * Constructs a new SeedsLayoutsManager object.
   */
  public function __construct(EntityTypeManager $entity_type_manager, ConfigFactoryInterface $config_factory, Php $uuid) {
  public function __construct(EntityTypeManager $entity_type_manager, ConfigFactoryInterface $config_factory, UuidInterface $uuid) {
    $this->entityTypeManager = $entity_type_manager;
    $this->configFactory = $config_factory;
    $frameworks_config_path = drupal_get_path('module', 'seeds_layouts') . '/config/framework';