, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/README.txt b/frontend/drupal9/web/modules/contrib/entity_clone/README.txt
new file mode 100644
index 000000000..8f1ed3c7a
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/README.txt
@@ -0,0 +1,14 @@
+README.txt
+==========
+
+What is this module?
+--------------------
+
+This module add a new entity operation which allows to clone many
+of the entities (config & content) provided by the Drupal core.
+
+How does it work?
+-----------------
+
+The module add a new operation on each entity in all manage lists.
+Just click on the clone button to process the clone operation.
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/config/schema/entity_clone.settings.schema.yml b/frontend/drupal9/web/modules/contrib/entity_clone/config/schema/entity_clone.settings.schema.yml
new file mode 100644
index 000000000..602453c34
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/config/schema/entity_clone.settings.schema.yml
@@ -0,0 +1,88 @@
+entity_clone.settings:
+ type: config_object
+ label: 'Module entity_clone settings'
+ mapping:
+ form_settings:
+ type: mapping
+ mapping:
+ taxonomy_term:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ block_content:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ comment:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ contact_message:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ file:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ node:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ shortcut:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ user:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
+ menu_link_content:
+ type: mapping
+ mapping:
+ default_value:
+ type: boolean
+ disable:
+ type: boolean
+ hidden:
+ type: boolean
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.api.php b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.api.php
new file mode 100644
index 000000000..a52b258c1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.api.php
@@ -0,0 +1,63 @@
+
+ * ```yaml
+ * my_module.my_event_subscriber:
+ * class: Drupal\my_module\EventSubscriber\MyEntityCloneEventSubscriber
+ * tags:
+ * - { name: event_subscriber }
+ * ```
+ *
+ *
+ * Code for src/EventSubscriber/MyEntityCloneEventSubscriber.php
+ *
+ *
+ *
+ */
+class MyEntityCloneEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface {
+
+ /**
+ * An example event subscriber.
+ *
+ * Dispatched before an entity is cloned and saved.
+ *
+ * @see \Drupal\entity_clone\Event\EntityCloneEvents::PRE_CLONE
+ */
+ public function myPreClone(\Drupal\entity_clone\Event\EntityCloneEvent $event): void {
+ $original = $event->getEntity();
+ $newEntity = $event->getClonedEntity();
+ }
+
+ /**
+ * An example event subscriber.
+ *
+ * Dispatched after an entity is cloned and saved.
+ *
+ * @see \Drupal\entity_clone\Event\EntityCloneEvents::POST_CLONE
+ */
+ public function myPostClone(\Drupal\entity_clone\Event\EntityCloneEvent $event): void {
+ $original = $event->getEntity();
+ $newEntity = $event->getClonedEntity();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents(): array {
+ $events[\Drupal\entity_clone\Event\EntityCloneEvents::PRE_CLONE][] = ['myPreClone'];
+ $events[\Drupal\entity_clone\Event\EntityCloneEvents::POST_CLONE][] = ['myPostClone'];
+ return $events;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.info.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.info.yml
new file mode 100644
index 000000000..8e74f61ba
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.info.yml
@@ -0,0 +1,11 @@
+name: Entity Clone
+description: Add a clone action for all entities
+core: "8.x"
+core_version_requirement: ^8 || ^9
+type: module
+configure: entity_clone.settings
+
+# Information added by Drupal.org packaging script on 2021-03-31
+version: '8.x-1.0-beta6'
+project: 'entity_clone'
+datestamp: 1617210000
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.menu.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.menu.yml
new file mode 100644
index 000000000..f013a12f9
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.menu.yml
@@ -0,0 +1,5 @@
+entity_clone.settings:
+ title: 'Entity clone settings'
+ description: 'Entity clone settings.'
+ route_name: entity_clone.settings
+ parent: 'system.admin_config_content'
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.task.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.task.yml
new file mode 100644
index 000000000..427f5759d
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.links.task.yml
@@ -0,0 +1,8 @@
+entity_clone.clone:
+ deriver: 'Drupal\entity_clone\Plugin\Derivative\DynamicLocalTasks'
+ weight: 100
+entity_clone.settings:
+ title: 'Entity clone settings'
+ route_name: entity_clone.settings
+ base_route: entity_clone.settings
+ weight: 0
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.module b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.module
new file mode 100644
index 000000000..f2bdfba80
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.module
@@ -0,0 +1,146 @@
+' . t('About') . '';
+ $output .= '' . t('Provides a new operation to clone all Entities.') . '
';
+ return $output;
+
+ default:
+ return;
+
+ }
+}
+
+/**
+ * Implements hook_entity_type_build().
+ */
+function entity_clone_entity_type_build(array &$entity_types) {
+ $specific_handler = [
+ 'file' => [
+ 'entity_clone' => FileEntityClone::class,
+ ],
+ 'user' => [
+ 'entity_clone' => UserEntityClone::class,
+ ],
+ 'field_config' => [
+ 'entity_clone' => FieldConfigEntityClone::class,
+ ],
+ 'node_type' => [
+ 'entity_clone' => ConfigWithFieldEntityClone::class,
+ ],
+ 'comment_type' => [
+ 'entity_clone' => ConfigWithFieldEntityClone::class,
+ ],
+ 'block_content_type' => [
+ 'entity_clone' => ConfigWithFieldEntityClone::class,
+ ],
+ 'contact_form' => [
+ 'entity_clone' => ConfigWithFieldEntityClone::class,
+ ],
+ 'taxonomy_term' => [
+ 'entity_clone' => TaxonomyTermEntityClone::class,
+ ],
+ 'menu' => [
+ 'entity_clone_form' => MenuEntityCloneForm::class,
+ 'entity_clone' => MenuEntityClone::class,
+ ],
+ 'taxonomy_vocabulary' => [
+ 'entity_clone' => ConfigWithFieldEntityClone::class,
+ ],
+ 'entity_view_display' => [
+ 'entity_clone' => \Drupal::moduleHandler()->moduleExists('layout_builder') ? LayoutBuilderEntityClone::class : NULL,
+ ],
+ ];
+
+ /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
+ foreach ($entity_types as $entity_type_id => $entity_type) {
+ $has_entity_clone_handler = $entity_type->getHandlerClass('entity_clone');
+ if (!$has_entity_clone_handler) {
+ if ($entity_type instanceof ContentEntityTypeInterface) {
+ $entity_type->setHandlerClass('entity_clone', ContentEntityCloneBase::class);
+ $entity_type->setHandlerClass('entity_clone_form', ContentEntityCloneFormBase::class);
+ }
+ elseif ($entity_type instanceof ConfigEntityTypeInterface) {
+ $entity_type->setHandlerClass('entity_clone', ConfigEntityCloneBase::class);
+ $entity_type->setHandlerClass('entity_clone_form', ConfigEntityCloneFormBase::class);
+ }
+ }
+
+ if (isset($specific_handler[$entity_type->id()]['entity_clone'])) {
+ $entity_type->setHandlerClass('entity_clone', $specific_handler[$entity_type->id()]['entity_clone']);
+ }
+ if (isset($specific_handler[$entity_type->id()]['entity_clone_form'])) {
+ $entity_type->setHandlerClass('entity_clone_form', $specific_handler[$entity_type->id()]['entity_clone_form']);
+ }
+
+ $entity_type->setLinkTemplate('clone-form', "/entity_clone/$entity_type_id/{{$entity_type_id}}");
+ }
+}
+
+/**
+ * Declares entity operations.
+ *
+ * @param \Drupal\Core\Entity\EntityInterface $entity
+ * The entity on which the linked operations will be performed.
+ *
+ * @return array
+ * An operations array as returned by
+ * EntityListBuilderInterface::getOperations().
+ *
+ * @see \Drupal\Core\Entity\EntityListBuilderInterface::getOperations()
+ */
+function entity_clone_entity_operation(EntityInterface $entity) {
+ if ($entity->hasLinkTemplate('clone-form') && $entity->access('clone')) {
+ return [
+ 'clone' => [
+ 'title' => t('Clone'),
+ 'weight' => 50,
+ 'url' => $entity->toUrl('clone-form')
+ ->mergeOptions(['query' => \Drupal::destination()->getAsArray()]),
+ ],
+ ];
+ }
+
+ return [];
+}
+
+/**
+ * Implements hook_entity_access().
+ */
+function entity_clone_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {
+ if ($operation === 'clone') {
+ return AccessResult::allowedIfHasPermission($account, 'clone ' . $entity->getEntityTypeId() . ' entity');
+ }
+ return AccessResult::neutral();
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.permissions.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.permissions.yml
new file mode 100644
index 000000000..406989303
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.permissions.yml
@@ -0,0 +1,5 @@
+administer entity clone:
+ title: 'Administer entity clone'
+
+permission_callbacks:
+ - Drupal\entity_clone\EntityClonePermissions::permissions
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.post_update.php b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.post_update.php
new file mode 100644
index 000000000..08f25a5a6
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.post_update.php
@@ -0,0 +1,27 @@
+get('entity_clone.settings')->get('form_settings');
+ if (!$form_settings) {
+ /** @var \Drupal\entity_clone\EntityCloneSettingsManager $entity_clone_settings_manager */
+ $entity_clone_settings_manager = \Drupal::service('entity_clone.settings.manager');
+ $form_settings = [];
+ foreach (array_keys($entity_clone_settings_manager->getContentEntityTypes()) as $entity_type_id) {
+ $form_settings[$entity_type_id] = [
+ 'default_value' => FALSE,
+ 'disable' => FALSE,
+ 'hidden' => FALSE,
+ ];
+ }
+
+ \Drupal::configFactory()->getEditable('entity_clone.settings')->set('form_settings', $form_settings)->save();
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.routing.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.routing.yml
new file mode 100644
index 000000000..b89a94b73
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.routing.yml
@@ -0,0 +1,9 @@
+entity_clone.settings:
+ path: '/admin/config/system/entity-clone'
+ defaults:
+ _form: 'Drupal\entity_clone\Form\EntityCloneSettingsForm'
+ _title: 'Entity clone settings'
+ options:
+ _admin_route: TRUE
+ requirements:
+ _permission: 'administer entity clone'
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.services.yml b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.services.yml
new file mode 100644
index 000000000..122aed125
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/entity_clone.services.yml
@@ -0,0 +1,12 @@
+services:
+ entity_clone.settings.manager:
+ class: Drupal\entity_clone\EntityCloneSettingsManager
+ arguments: ['@entity_type.manager', '@entity_type.bundle.info', '@config.factory']
+ entity_clone.route_subscriber:
+ class: Drupal\entity_clone\Routing\RouteSubscriber
+ arguments: ['@entity_type.manager']
+ tags:
+ - { name: event_subscriber }
+ entity_clone.service_provider:
+ class: Drupal\entity_clone\Services\EntityCloneServiceProvider
+ arguments: [ ]
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneBase.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneBase.php
new file mode 100644
index 000000000..c0c33490a
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneBase.php
@@ -0,0 +1,86 @@
+entityTypeManager = $entity_type_manager;
+ $this->entityTypeId = $entity_type_id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $entity_type->id()
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = []) {
+ /** @var \Drupal\core\Config\Entity\ConfigEntityInterface $cloned_entity */
+ $id_key = $this->entityTypeManager->getDefinition($this->entityTypeId)->getKey('id');
+ $label_key = $this->entityTypeManager->getDefinition($this->entityTypeId)->getKey('label');
+
+ // Set new entity properties.
+ if (isset($properties['id'])) {
+ if ($id_key) {
+ $cloned_entity->set($id_key, $properties['id']);
+ }
+ unset($properties['id']);
+ }
+
+ if (isset($properties['label'])) {
+ if ($label_key) {
+ $cloned_entity->set($label_key, $properties['label']);
+ }
+ unset($properties['label']);
+ }
+
+ foreach ($properties as $key => $property) {
+ $cloned_entity->set($key, $property);
+ }
+
+ $cloned_entity->save();
+ return $cloned_entity;
+
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneFormBase.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneFormBase.php
new file mode 100644
index 000000000..6ebcc1929
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigEntityCloneFormBase.php
@@ -0,0 +1,118 @@
+entityTypeManager = $entity_type_manager;
+ $this->translationManager = $translation_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $container->get('string_translation')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function formElement(EntityInterface $entity, $parent = TRUE) {
+ $form = [];
+
+ if ($this->entityTypeManager->getDefinition($entity->getEntityTypeId())->getKey('label')) {
+ $form['label'] = [
+ '#type' => 'textfield',
+ '#title' => $this->translationManager->translate('New Label'),
+ '#maxlength' => 255,
+ '#required' => TRUE,
+ ];
+ }
+
+ // In common casse, config entities IDs are limited to 64 characters ...
+ $max_length = 64;
+ if ($entity->getEntityType()->getBundleOf()) {
+ // ... Except for bundle definition, that are limited to 32 characters.
+ $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
+ }
+
+ $form['id'] = [
+ '#type' => 'machine_name',
+ '#title' => $this->translationManager->translate('New Id'),
+ '#maxlength' => $max_length,
+ '#required' => TRUE,
+ ];
+
+ // If entity must have a prefix
+ // (e.g. entity_form_mode, entity_view_mode, ...).
+ if (method_exists($entity, 'getTargetType')) {
+ $form['id']['#field_prefix'] = $entity->getTargetType() . '.';
+ }
+
+ if (method_exists($entity, 'load')) {
+ $form['id']['#machine_name'] = [
+ 'exists' => get_class($entity) . '::load',
+ ];
+ }
+
+ return $form;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getValues(FormStateInterface $form_state) {
+ // If entity must have a prefix
+ // (e.g. entity_form_mode, entity_view_mode, ...).
+ $field_prefix = '';
+ if (isset($form_state->getCompleteForm()['id']['#field_prefix'])) {
+ $field_prefix = $form_state->getCompleteForm()['id']['#field_prefix'];
+ }
+
+ return [
+ 'id' => $field_prefix . $form_state->getValue('id'),
+ 'label' => $form_state->getValue('label'),
+ ];
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigWithFieldEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigWithFieldEntityClone.php
new file mode 100644
index 000000000..322925a9a
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/ConfigWithFieldEntityClone.php
@@ -0,0 +1,105 @@
+getEntityType()->getBundleOf();
+ if ($bundle_of) {
+ $this->cloneFields($entity->id(), $cloned_entity->id(), $bundle_of);
+ }
+
+ $view_displays = \Drupal::service('entity_display.repository')->getFormModes($bundle_of);
+ $view_displays = array_merge($view_displays, ['default' => 'default']);
+ if (!empty($view_displays)) {
+ $this->cloneDisplays('form', $entity->id(), $cloned_entity->id(), $view_displays, $bundle_of);
+ }
+
+ $view_displays = \Drupal::service('entity_display.repository')->getViewModes($bundle_of);
+ $view_displays = array_merge($view_displays, ['default' => 'default']);
+ if (!empty($view_displays)) {
+ $this->cloneDisplays('view', $entity->id(), $cloned_entity->id(), $view_displays, $bundle_of);
+ }
+
+ return $cloned_entity;
+ }
+
+ /**
+ * Clone all fields. Each field re-use existing field storage.
+ *
+ * @param string $entity_id
+ * The base entity ID.
+ * @param string $cloned_entity_id
+ * The cloned entity ID.
+ * @param string $bundle_of
+ * The bundle of the cloned entity.
+ */
+ protected function cloneFields($entity_id, $cloned_entity_id, $bundle_of) {
+ /** @var \Drupal\Core\Entity\EntityFieldManager $field_manager */
+ $field_manager = \Drupal::service('entity_field.manager');
+ $fields = $field_manager->getFieldDefinitions($bundle_of, $entity_id);
+ foreach ($fields as $field_definition) {
+ if ($field_definition instanceof FieldConfigInterface) {
+ if ($this->entityTypeManager->hasHandler($this->entityTypeManager->getDefinition($field_definition->getEntityTypeId())
+ ->id(), 'entity_clone')
+ ) {
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneInterface $field_config_clone_handler */
+ $field_config_clone_handler = $this->entityTypeManager->getHandler($this->entityTypeManager->getDefinition($field_definition->getEntityTypeId())
+ ->id(), 'entity_clone');
+ $field_config_properties = [
+ 'id' => $field_definition->getName(),
+ 'label' => $field_definition->label(),
+ 'skip_storage' => TRUE,
+ ];
+ $cloned_field_definition = $field_definition->createDuplicate();
+ $cloned_field_definition->set('bundle', $cloned_entity_id);
+ $field_config_clone_handler->cloneEntity($field_definition, $cloned_field_definition, $field_config_properties);
+ }
+ }
+ }
+ }
+
+ /**
+ * Clone all fields. Each field re-use existing field storage.
+ *
+ * @param string $type
+ * The type of display (view or form).
+ * @param string $entity_id
+ * The base entity ID.
+ * @param string $cloned_entity_id
+ * The cloned entity ID.
+ * @param array $view_displays
+ * All view available display for this type.
+ * @param string $bundle_of
+ * The bundle of the cloned entity.
+ */
+ protected function cloneDisplays($type, $entity_id, $cloned_entity_id, array $view_displays, $bundle_of) {
+ foreach ($view_displays as $view_display_id => $view_display) {
+ /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */
+ $display = $this->entityTypeManager->getStorage('entity_' . $type . '_display')->load($bundle_of . '.' . $entity_id . '.' . $view_display_id);
+ if ($display) {
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneInterface $view_display_clone_handler */
+ $view_display_clone_handler = $this->entityTypeManager->getHandler($this->entityTypeManager->getDefinition($display->getEntityTypeId())
+ ->id(), 'entity_clone');
+ $view_display_properties = [
+ 'id' => $bundle_of . '.' . $cloned_entity_id . '.' . $view_display_id,
+ ];
+ $cloned_view_display = $display->createDuplicate();
+ $cloned_view_display->set('bundle', $cloned_entity_id);
+ $view_display_clone_handler->cloneEntity($display, $cloned_view_display, $view_display_properties);
+ }
+ }
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/FieldConfigEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/FieldConfigEntityClone.php
new file mode 100644
index 000000000..b16d1edaf
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/FieldConfigEntityClone.php
@@ -0,0 +1,33 @@
+getFieldStorageDefinition()->createDuplicate();
+ $cloned_field_storage->set('field_name', $properties['id']);
+ $cloned_field_storage->set('id', $properties['id'] . '.' . $cloned_field_storage->getTargetEntityTypeId());
+ $cloned_field_storage->save();
+ }
+ unset($properties['skip_storage']);
+
+ $properties['field_name'] = $properties['id'];
+ $properties['id'] = $cloned_field_config->getTargetEntityTypeId() . '.' . $cloned_field_config->getTargetBundle() . '.' . $properties['id'];
+ return parent::cloneEntity($field_config, $cloned_field_config, $properties);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/LayoutBuilderEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/LayoutBuilderEntityClone.php
new file mode 100644
index 000000000..9bf8b9c10
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/LayoutBuilderEntityClone.php
@@ -0,0 +1,104 @@
+uuidGenerator = $uuid;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $entity_type->id(),
+ $container->get('uuid')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = []) {
+ /** @var $cloned_entity \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface */
+ /** @var $entity \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface */
+ // We need to create an entity, save it, then adjust layout builder settings
+ // and save it again, because for new entities layout_builder module stacks
+ // all fields into display.
+ // @see \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::preSave()
+ $cloned_entity = parent::cloneEntity($entity, $cloned_entity, $properties);
+ if ($cloned_entity->isLayoutBuilderEnabled()) {
+ $cloned_entity->removeAllSections();
+ foreach ($entity->getSections() as $section) {
+ $cloned_components = [];
+ foreach ($section->getComponents() as $section_component) {
+ $plugin = $section_component->getPlugin();
+ $component_array = $section_component->toArray();
+ $deriver_id = $plugin->getPluginDefinition()['id'];
+ switch ($deriver_id) {
+ case 'field_block':
+ case 'extra_field_block':
+ $full_id = explode(PluginBase::DERIVATIVE_SEPARATOR, $plugin->getPluginId());
+ $field_name = end($full_id);
+ $derivative_id = $cloned_entity->getTargetEntityTypeId() . PluginBase::DERIVATIVE_SEPARATOR . $cloned_entity->getTargetBundle() . PluginBase::DERIVATIVE_SEPARATOR . $field_name;
+ break;
+
+ case 'inline_block':
+ $derivative_id = $plugin->getDerivativeId();
+ break;
+
+ default:
+ if ($plugin instanceof DerivativeInspectionInterface) {
+ $derivative_id = $plugin->getDerivativeId();
+ }
+ else {
+ $derivative_id = '';
+ }
+ break;
+ }
+ $cloned_plugin_id = $deriver_id . (!empty($derivative_id) ? PluginBase::DERIVATIVE_SEPARATOR . $derivative_id : '');
+ $component_array['uuid'] = $this->uuidGenerator->generate();
+ $component_array['configuration']['id'] = $cloned_plugin_id;
+ $cloned_components[] = SectionComponent::fromArray($component_array);
+ }
+ // We don't expect here third-party settings, but just in case.
+ $third_party_settings = [];
+ foreach ($section->getThirdPartyProviders() as $third_party_provider) {
+ $third_party_settings[$third_party_provider] = $section->getThirdPartySettings($third_party_provider);
+ }
+ $cloned_section = new Section($section->getLayoutId(), $section->getLayoutSettings(), $cloned_components, $third_party_settings);
+ $cloned_entity->appendSection($cloned_section);
+ }
+ $cloned_entity->save();
+ }
+ return $cloned_entity;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityClone.php
new file mode 100644
index 000000000..c83c6da38
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityClone.php
@@ -0,0 +1,21 @@
+set('locked', FALSE);
+ return parent::cloneEntity($entity, $cloned_entity, $properties);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityCloneForm.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityCloneForm.php
new file mode 100644
index 000000000..4df877832
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Config/MenuEntityCloneForm.php
@@ -0,0 +1,26 @@
+ '[^a-z0-9-]+',
+ 'replace' => '-',
+ ];
+ return $form;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneBase.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneBase.php
new file mode 100644
index 000000000..af6eb027e
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneBase.php
@@ -0,0 +1,230 @@
+entityTypeManager = $entity_type_manager;
+ $this->entityTypeId = $entity_type_id;
+ $this->timeService = $time_service;
+ $this->currentUser = $currentUser;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $entity_type->id(),
+ $container->get('datetime.time'),
+ $container->get('current_user')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function cloneEntity(EntityInterface $entity, EntityInterface $cloned_entity, array $properties = [], array &$already_cloned = []) {
+ if (isset($properties['take_ownership']) && $properties['take_ownership'] === 1) {
+ $cloned_entity->setOwnerId($this->currentUser->id());
+ }
+ // Clone referenced entities.
+ $cloned_entity->save();
+ $already_cloned[$entity->getEntityTypeId()][$entity->id()] = $cloned_entity;
+ if ($cloned_entity instanceof FieldableEntityInterface && $entity instanceof FieldableEntityInterface) {
+ foreach ($cloned_entity->getFieldDefinitions() as $field_id => $field_definition) {
+ if ($this->fieldIsClonable($field_definition)) {
+ $field = $entity->get($field_id);
+ /** @var \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $value */
+ if ($field->count() > 0) {
+ $cloned_entity->set($field_id, $this->cloneReferencedEntities($field, $field_definition, $properties, $already_cloned));
+ }
+ }
+ }
+ }
+
+ $this->setClonedEntityLabel($entity, $cloned_entity);
+
+ // For now, check that the cloned entity has a 'setCreatedTime' method, and
+ // if so, try to call it. This condition can be replaced with a more-robust
+ // check whether $cloned_entity is an instance of
+ // Drupal\Core\Entity\EntityCreatedInterface once
+ // https://www.drupal.org/project/drupal/issues/2833378 lands.
+ if (method_exists($cloned_entity, 'setCreatedTime')) {
+ $cloned_entity->setCreatedTime($this->timeService->getRequestTime());
+ }
+
+ $cloned_entity->save();
+ return $cloned_entity;
+ }
+
+ /**
+ * Determines if a field is clonable.
+ *
+ * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
+ * The field definition.
+ *
+ * @return bool
+ * TRUE if the field is clonable; FALSE otherwise.
+ */
+ protected function fieldIsClonable(FieldDefinitionInterface $field_definition) {
+ $clonable_field_types = [
+ 'entity_reference',
+ 'entity_reference_revisions',
+ ];
+
+ $type_is_clonable = in_array($field_definition->getType(), $clonable_field_types, TRUE);
+ if (($field_definition instanceof FieldConfigInterface) && $type_is_clonable) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ /**
+ * Sets the cloned entity's label.
+ *
+ * @param \Drupal\Core\Entity\EntityInterface $original_entity
+ * The original entity.
+ * @param \Drupal\Core\Entity\EntityInterface $cloned_entity
+ * The entity cloned from the original.
+ */
+ protected function setClonedEntityLabel(EntityInterface $original_entity, EntityInterface $cloned_entity) {
+ $label_key = $this->entityTypeManager->getDefinition($this->entityTypeId)->getKey('label');
+ if ($label_key && $cloned_entity->hasField($label_key)) {
+ $cloned_entity->set($label_key, $original_entity->label() . ' - Cloned');
+ }
+ }
+
+ /**
+ * Clones referenced entities.
+ *
+ * @param \Drupal\Core\Field\FieldItemListInterface $field
+ * The field item.
+ * @param \Drupal\Core\Field\FieldConfigInterface $field_definition
+ * The field definition.
+ * @param array $properties
+ * All new properties to replace old.
+ * @param array $already_cloned
+ * List of all already cloned entities, used for circular references.
+ *
+ * @return array
+ * Referenced entities.
+ */
+ protected function cloneReferencedEntities(FieldItemListInterface $field, FieldConfigInterface $field_definition, array $properties, array &$already_cloned) {
+ $referenced_entities = [];
+ foreach ($field as $value) {
+ // Check if we're not dealing with an entity
+ // that has been deleted in the meantime.
+ if (!$referenced_entity = $value->get('entity')->getTarget()) {
+ continue;
+ }
+ /** @var \Drupal\Core\Entity\ContentEntityInterface $referenced_entity */
+ $referenced_entity = $value->get('entity')->getTarget()->getValue();
+ $child_properties = $this->getChildProperties($properties, $field_definition, $referenced_entity);
+ if (!empty($child_properties['clone'])) {
+
+ $cloned_reference = $referenced_entity->createDuplicate();
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneInterface $entity_clone_handler */
+ $entity_clone_handler = $this->entityTypeManager->getHandler($referenced_entity->getEntityTypeId(), 'entity_clone');
+ $entity_clone_handler->cloneEntity($referenced_entity, $cloned_reference, $child_properties['children'], $already_cloned);
+
+ $referenced_entities[] = $cloned_reference;
+ }
+ elseif (!empty($child_properties['is_circular'])) {
+ if (!empty($already_cloned[$referenced_entity->getEntityTypeId()][$referenced_entity->id()])) {
+ $referenced_entities[] = $already_cloned[$referenced_entity->getEntityTypeId()][$referenced_entity->id()];
+ }
+ else {
+ $referenced_entities[] = $referenced_entity;
+ }
+ }
+ else {
+ $referenced_entities[] = $referenced_entity;
+ }
+ }
+ return $referenced_entities;
+ }
+
+ /**
+ * Fetches the properties of a child entity.
+ *
+ * @param array $properties
+ * Properties of the clone operation.
+ * @param \Drupal\Core\Field\FieldConfigInterface $field_definition
+ * The field definition.
+ * @param \Drupal\Core\Entity\EntityInterface $referenced_entity
+ * The field's target entity.
+ *
+ * @return array
+ * Child properties.
+ */
+ protected function getChildProperties(array $properties, FieldConfigInterface $field_definition, EntityInterface $referenced_entity) {
+ $child_properties = [];
+ if (isset($properties['recursive'][$field_definition->id()]['references'][$referenced_entity->id()])) {
+ $child_properties = $properties['recursive'][$field_definition->id()]['references'][$referenced_entity->id()];
+ }
+ if (!isset($child_properties['children'])) {
+ $child_properties['children'] = [];
+ }
+ return $child_properties;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneFormBase.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneFormBase.php
new file mode 100644
index 000000000..0aef96b8b
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/ContentEntityCloneFormBase.php
@@ -0,0 +1,294 @@
+entityTypeManager = $entity_type_manager;
+ $this->translationManager = $translation_manager;
+ $this->entityCloneSettingsManager = $entity_clone_settings_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $container->get('string_translation'),
+ $container->get('entity_clone.settings.manager')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function formElement(EntityInterface $entity, $parent = TRUE, &$discovered_entities = []) {
+ $form = [
+ 'recursive' => [],
+ ];
+
+ if ($entity instanceof FieldableEntityInterface) {
+ $discovered_entities[$entity->getEntityTypeId()][$entity->id()] = $entity;
+ foreach ($entity->getFieldDefinitions() as $field_id => $field_definition) {
+ if ($field_definition instanceof FieldConfigInterface && in_array($field_definition->getType(), ['entity_reference', 'entity_reference_revisions'], TRUE)) {
+ $field = $entity->get($field_id);
+ /** @var \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $value */
+ if ($field->count() > 0
+ && $this->entityTypeManager->getStorage($field->getSetting('target_type')) instanceof ContentEntityStorageInterface) {
+ $form['recursive'] = array_merge($form['recursive'], $this->getRecursiveFormElement($field_definition, $field_id, $field, $discovered_entities));
+ }
+ }
+ }
+
+ if ($parent) {
+ $form = array_merge([
+ 'description' => [
+ '#markup' => $this->getFormDescription($form, $entity),
+ '#access' => TRUE,
+ ],
+ ], $form);
+ }
+ }
+
+ return $form;
+ }
+
+ /**
+ * Get the recursive form element.
+ *
+ * @param \Drupal\Core\Field\FieldConfigInterface $field_definition
+ * The field definition.
+ * @param string $field_id
+ * The field ID.
+ * @param \Drupal\Core\Field\FieldItemListInterface $field
+ * The field item.
+ * @param array $discovered_entities
+ * List of all entities already discovered.
+ *
+ * @return array
+ * The form element for a recursive clone.
+ */
+ protected function getRecursiveFormElement(FieldConfigInterface $field_definition, $field_id, FieldItemListInterface $field, array &$discovered_entities) {
+ $form_element = [
+ '#tree' => TRUE,
+ ];
+
+ $fieldset_access = !$this->entityCloneSettingsManager->getHiddenValue($field_definition->getFieldStorageDefinition()->getSetting('target_type'));
+ $form_element[$field_definition->id()] = [
+ '#type' => 'fieldset',
+ '#title' => $this->translationManager->translate('Entities referenced by field @label (@field_id).', [
+ '@label' => $field_definition->label(),
+ '@field_id' => $field_id,
+ ]),
+ '#access' => $fieldset_access,
+ '#description_should_be_shown' => $fieldset_access,
+ ];
+
+ foreach ($field as $value) {
+ // Check if we're not dealing with an entity
+ // That has been deleted in the meantime.
+ if (!$referenced_entity = $value->get('entity')->getTarget()) {
+ continue;
+ }
+ /** @var \Drupal\Core\Entity\ContentEntityInterface $referenced_entity */
+ $referenced_entity = $value->get('entity')->getTarget()->getValue();
+
+ if (isset($discovered_entities[$referenced_entity->getEntityTypeId()]) && array_key_exists($referenced_entity->id(), $discovered_entities[$referenced_entity->getEntityTypeId()])) {
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['is_circular'] = [
+ '#type' => 'hidden',
+ '#value' => TRUE,
+ ];
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['circular'] = [
+ '#type' => 'item',
+ '#markup' => $this->translationManager->translate('Circular reference detected'),
+ ];
+ }
+ else {
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['clone'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->translationManager->translate('Clone entity ID: @entity_id, Type: @entity_type - @bundle, Label: @entity_label', [
+ '@entity_id' => $referenced_entity->id(),
+ '@entity_type' => $referenced_entity->getEntityTypeId(),
+ '@bundle' => $referenced_entity->bundle(),
+ '@entity_label' => $referenced_entity->label(),
+ ]),
+ '#default_value' => $this->entityCloneSettingsManager->getDefaultValue($referenced_entity->getEntityTypeId()),
+ '#access' => $referenced_entity->access('view label'),
+ ];
+
+ if ($this->entityCloneSettingsManager->getDisableValue($referenced_entity->getEntityTypeId())) {
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['clone']['#attributes'] = [
+ 'disabled' => TRUE,
+ ];
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['clone']['#value'] = $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['clone']['#default_value'];
+ }
+
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['target_entity_type_id'] = [
+ '#type' => 'hidden',
+ '#value' => $referenced_entity->getEntityTypeId(),
+ ];
+
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['target_bundle'] = [
+ '#type' => 'hidden',
+ '#value' => $referenced_entity->bundle(),
+ ];
+ if ($referenced_entity instanceof ContentEntityInterface) {
+ $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['children'] = $this->getChildren($referenced_entity, $discovered_entities);
+ }
+ }
+ }
+
+ return $form_element;
+ }
+
+ /**
+ * Fetches clonable children from a field.
+ *
+ * @param \Drupal\Core\Entity\ContentEntityInterface $referenced_entity
+ * The field item list.
+ * @param array $discovered_entities
+ * List of all entities already discovered.
+ *
+ * @return array
+ * The list of children.
+ */
+ protected function getChildren(ContentEntityInterface $referenced_entity, array &$discovered_entities) {
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneFormInterface $entity_clone_handler */
+ if ($this->entityTypeManager->hasHandler($referenced_entity->getEntityTypeId(), 'entity_clone_form')) {
+ // Record that we've found this entity.
+ $discovered_entities[$referenced_entity->getEntityTypeId()][$referenced_entity->id()] = $referenced_entity;
+
+ $entity_clone_form_handler = $this->entityTypeManager->getHandler($referenced_entity->getEntityTypeId(), 'entity_clone_form');
+ return $entity_clone_form_handler->formElement($referenced_entity, FALSE, $discovered_entities);
+ }
+
+ return [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getValues(FormStateInterface $form_state) {
+ return $form_state->getValues();
+ }
+
+ /**
+ * Get the clone form confirmation page description.
+ *
+ * If there are no recursive elements visible, the default description should
+ * be shown.
+ *
+ * @param array $form
+ * The clone form.
+ * @param \Drupal\Core\Entity\EntityInterface $entity
+ * The entity.
+ *
+ * @return \Drupal\Core\StringTranslation\TranslatableMarkup
+ * Description to be shown
+ */
+ protected function getFormDescription(array $form, EntityInterface $entity) {
+ $has_recursive = FALSE;
+ $elements_visible = FALSE;
+
+ if (isset($form['recursive'])) {
+ $has_recursive = TRUE;
+ }
+
+ array_walk_recursive($form['recursive'], function ($item, $key) use (&$elements_visible) {
+ if ($key === '#description_should_be_shown') {
+ $elements_visible = ($elements_visible || $item);
+ }
+ });
+
+ if ($has_recursive && $elements_visible) {
+ return $this->translationManager->translate("
+ Specify the child entities (the entities referenced by this entity) that should also be cloned as part of
+ the cloning process. If they're not included, these fields' referenced entities will be the same as in the
+ original. In other words, fields in both the original entity and the cloned entity will refer to the same
+ referenced entity. Examples:
+
+ If you have a Paragraph field in your entity, and you choose not to clone it here, deleting the original
+ or cloned entity will also delete the Paragraph field from the other one. So you probably want to clone
+ Paragraph fields.
+
+ However, if you have a User reference field, you probably don't want to clone it here because a new User
+ will be created for referencing by the clone.
+
+ Some options may be disabled here, preventing you from changing them, as set by your administrator. Some
+ options may also be missing, hidden by your administrator, forcing you to clone with the default settings.
+ It's possible that there are no options here for you at all, or none need to be set, in which case you may
+ simply hit the Clone button.
+ ");
+ }
+ else {
+ return $this->translationManager->translate("Do you want to clone the @type entity named @title?
", [
+ "@type" => $entity->getEntityType()->getLabel(),
+ "@title" => $entity->label(),
+ ]);
+ }
+
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/FileEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/FileEntityClone.php
new file mode 100644
index 000000000..4821b0d01
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/FileEntityClone.php
@@ -0,0 +1,25 @@
+getFileUri(), FileSystemInterface::EXISTS_RENAME);
+ if (isset($properties['take_ownership']) && $properties['take_ownership'] === 1) {
+ $cloned_file->setOwnerId(\Drupal::currentUser()->id());
+ }
+ return parent::cloneEntity($entity, $cloned_file, $properties);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/TaxonomyTermEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/TaxonomyTermEntityClone.php
new file mode 100644
index 000000000..3e4da6a36
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/TaxonomyTermEntityClone.php
@@ -0,0 +1,26 @@
+parent->target_id)) {
+ $cloned_entity->set('parent', 0);
+ }
+ return parent::cloneEntity($entity, $cloned_entity, $properties);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/UserEntityClone.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/UserEntityClone.php
new file mode 100644
index 000000000..844deca3e
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/Content/UserEntityClone.php
@@ -0,0 +1,21 @@
+set('name', $cloned_entity->getAccountName() . '_cloned');
+ return parent::cloneEntity($entity, $cloned_entity, $properties);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/EntityCloneFormInterface.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/EntityCloneFormInterface.php
new file mode 100644
index 000000000..c1656a71f
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityClone/EntityCloneFormInterface.php
@@ -0,0 +1,37 @@
+entityTypeManager = $entity_manager;
+ $this->translationManager = $string_translation;
+ $this->serviceProvider = $service_provider;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $container->get('string_translation'),
+ $container->get('entity_clone.service_provider')
+ );
+ }
+
+ /**
+ * Returns an array of entity_clone permissions.
+ *
+ * @return array
+ * The permission list.
+ */
+ public function permissions() {
+ $permissions = [];
+
+ foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
+ $permissions['clone ' . $entity_type_id . ' entity'] = $this->translationManager->translate('Clone all @label entities.', [
+ '@label' => $entity_type->getLabel(),
+ ]);
+
+ if ($this->serviceProvider->entityTypeHasOwnerTrait($entity_type)) {
+ $permissions['take_ownership_on_clone ' . $entity_type_id . ' entity'] = $this->translationManager->translate('Allow user to take ownership of @label cloned entities', [
+ '@label' => $entity_type->getLabel(),
+ ]);
+ }
+ }
+
+ return $permissions;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityCloneSettingsManager.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityCloneSettingsManager.php
new file mode 100644
index 000000000..6bf3ba60e
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/EntityCloneSettingsManager.php
@@ -0,0 +1,166 @@
+entityTypeManager = $entity_type_manager;
+ $this->entityTypeBundleInfo = $entity_type_bundle_info;
+ $this->config = $config_factory->get('entity_clone.settings');
+ $this->editableConfig = $config_factory->getEditable('entity_clone.settings');
+ }
+
+ /**
+ * Get all content entity types.
+ *
+ * @return \Drupal\Core\Entity\ContentEntityTypeInterface[]
+ * An array containing all content entity types.
+ */
+ public function getContentEntityTypes() {
+ $definitions = $this->entityTypeManager->getDefinitions();
+ $ret = [];
+ foreach ($definitions as $machine => $type) {
+ if ($type instanceof ContentEntityTypeInterface) {
+ $ret[$machine] = $type;
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Set the entity clone settings.
+ *
+ * @param array $settings
+ * The settings from the form.
+ */
+ public function setFormSettings(array $settings) {
+ if (isset($settings['table'])) {
+ array_walk_recursive($settings['table'], function (&$item) {
+ if ($item == '1') {
+ $item = TRUE;
+ }
+ else {
+ $item = FALSE;
+ }
+ });
+ $this->editableConfig->set('form_settings', $settings['table'])->save();
+ }
+ }
+
+ /**
+ * Get the checkbox default value for a given entity type.
+ *
+ * @param string $entity_type_id
+ * The entity type ID.
+ *
+ * @return bool
+ * The default value.
+ */
+ public function getDefaultValue($entity_type_id) {
+ $form_settings = $this->config->get('form_settings');
+ if (isset($form_settings[$entity_type_id]['default_value'])) {
+ return $form_settings[$entity_type_id]['default_value'];
+ }
+ return FALSE;
+ }
+
+ /**
+ * Get the checkbox disable value for a given entity type.
+ *
+ * @param string $entity_type_id
+ * The entity type ID.
+ *
+ * @return bool
+ * The disable value.
+ */
+ public function getDisableValue($entity_type_id) {
+ $form_settings = $this->config->get('form_settings');
+ if (isset($form_settings[$entity_type_id]['disable'])) {
+ return $form_settings[$entity_type_id]['disable'];
+ }
+ return FALSE;
+ }
+
+ /**
+ * Get the checkbox hidden value for a given entity type.
+ *
+ * @param string $entity_type_id
+ * The entity type ID.
+ *
+ * @return bool
+ * The hidden value.
+ */
+ public function getHiddenValue($entity_type_id) {
+ $form_settings = $this->config->get('form_settings');
+ if (isset($form_settings[$entity_type_id]['hidden'])) {
+ return $form_settings[$entity_type_id]['hidden'];
+ }
+ return FALSE;
+ }
+
+ /**
+ * Set the take ownership setting.
+ *
+ * @param int $setting
+ * The settings from the form.
+ */
+ public function setTakeOwnershipSettings(int $setting) {
+ $this->editableConfig->set('take_ownership', $setting)->save();
+ }
+
+ /**
+ * Get the take ownership settings.
+ */
+ public function getTakeOwnershipSetting() {
+ return $this->config->get('take_ownership') ?? FALSE;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvent.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvent.php
new file mode 100644
index 000000000..888992885
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvent.php
@@ -0,0 +1,80 @@
+entity = $entity;
+ $this->clonedEntity = $cloned_entity;
+ $this->properties = $properties;
+ }
+
+ /**
+ * Gets entity being cloned.
+ *
+ * @return \Drupal\Core\Entity\EntityInterface
+ * The original entity.
+ */
+ public function getEntity() {
+ return $this->entity;
+ }
+
+ /**
+ * Gets new cloned entity.
+ *
+ * @return \Drupal\Core\Entity\EntityInterface
+ * The cloned entity.
+ */
+ public function getClonedEntity() {
+ return $this->clonedEntity;
+ }
+
+ /**
+ * Gets entity properties.
+ *
+ * @return array
+ * The list of properties.
+ */
+ public function getProperties() {
+ return $this->properties;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvents.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvents.php
new file mode 100644
index 000000000..7faf8e229
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Event/EntityCloneEvents.php
@@ -0,0 +1,24 @@
+entityTypeManager = $entity_type_manager;
+ $this->stringTranslationManager = $string_translation;
+ $this->eventDispatcher = $eventDispatcher;
+ $this->messenger = $messenger;
+
+ $parameter_name = $route_match->getRouteObject()->getOption('_entity_clone_entity_type_id');
+ $this->entity = $route_match->getParameter($parameter_name);
+
+ $this->entityTypeDefinition = $entity_type_manager->getDefinition($this->entity->getEntityTypeId());
+ $this->currentUser = $currentUser;
+ $this->entityCloneSettingsManager = $entity_clone_settings_manager;
+ $this->serviceProvider = $service_provider;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $container->get('current_route_match'),
+ $container->get('string_translation'),
+ $container->get('event_dispatcher'),
+ $container->get('messenger'),
+ $container->get('current_user'),
+ $container->get('entity_clone.settings.manager'),
+ $container->get('entity_clone.service_provider')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFormId() {
+ return 'entity_clone_form';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(array $form, FormStateInterface $form_state) {
+ if ($this->entity && $this->entityTypeDefinition->hasHandlerClass('entity_clone')) {
+
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneFormInterface $entity_clone_handler */
+ if ($this->entityTypeManager->hasHandler($this->entityTypeDefinition->id(), 'entity_clone_form')) {
+ $entity_clone_form_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone_form');
+ $form = array_merge($form, $entity_clone_form_handler->formElement($this->entity));
+ }
+ $entityType = $this->getEntity()->getEntityTypeId();
+ if ($this->serviceProvider->entityTypeHasOwnerTrait($this->getEntity()->getEntityType()) && $this->currentUser->hasPermission('take_ownership_on_clone ' . $entityType . ' entity')) {
+ $form['take_ownership'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->stringTranslationManager->translate('Take ownership'),
+ '#default_value' => $this->entityCloneSettingsManager->getTakeOwnershipSetting(),
+ '#description' => $this->stringTranslationManager->translate('Take ownership of the newly created cloned entity.'),
+ ];
+ }
+
+ $form['actions'] = ['#type' => 'actions'];
+ $form['actions']['clone'] = [
+ '#type' => 'submit',
+ '#button_type' => 'primary',
+ '#value' => $this->stringTranslationManager->translate('Clone'),
+ ];
+
+ $form['actions']['abort'] = [
+ '#type' => 'submit',
+ '#value' => $this->stringTranslationManager->translate('Cancel'),
+ '#submit' => ['::cancelForm'],
+ ];
+ }
+
+ return $form;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function validateForm(array &$form, FormStateInterface $form_state) {}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function submitForm(array &$form, FormStateInterface $form_state) {
+ /** @var \Drupal\entity_clone\EntityClone\EntityCloneInterface $entity_clone_handler */
+ $entity_clone_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone');
+ if ($this->entityTypeManager->hasHandler($this->entityTypeDefinition->id(), 'entity_clone_form')) {
+ $entity_clone_form_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone_form');
+ }
+
+ $properties = [];
+ if (isset($entity_clone_form_handler) && $entity_clone_form_handler) {
+ $properties = $entity_clone_form_handler->getValues($form_state);
+ }
+
+ $duplicate = $this->entity->createDuplicate();
+
+ $this->eventDispatcher->dispatch(EntityCloneEvents::PRE_CLONE, new EntityCloneEvent($this->entity, $duplicate, $properties));
+ $cloned_entity = $entity_clone_handler->cloneEntity($this->entity, $duplicate, $properties);
+ $this->eventDispatcher->dispatch(EntityCloneEvents::POST_CLONE, new EntityCloneEvent($this->entity, $duplicate, $properties));
+
+ $this->messenger->addMessage($this->stringTranslationManager->translate('The entity @entity (@entity_id) of type @type was cloned.', [
+ '@entity' => $this->entity->label(),
+ '@entity_id' => $this->entity->id(),
+ '@type' => $this->entity->getEntityTypeId(),
+ ]));
+
+ $this->formSetRedirect($form_state, $cloned_entity);
+ }
+
+ /**
+ * Cancel form handler.
+ *
+ * @param array $form
+ * An associative array containing the structure of the form.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
+ */
+ public function cancelForm(array &$form, FormStateInterface $form_state) {
+ $this->formSetRedirect($form_state, $this->entity);
+ }
+
+ /**
+ * Sets a redirect on form state.
+ *
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The current state of the form.
+ * @param \Drupal\Core\Entity\EntityInterface $entity
+ * The cloned entity.
+ */
+ protected function formSetRedirect(FormStateInterface $form_state, EntityInterface $entity) {
+ if ($entity && $entity->hasLinkTemplate('canonical')) {
+ $form_state->setRedirect($entity->toUrl()->getRouteName(), $entity->toUrl()->getRouteParameters());
+ }
+ else {
+ $form_state->setRedirect('');
+ }
+ }
+
+ /**
+ * Gets the entity of this form.
+ *
+ * @return \Drupal\Core\Entity\EntityInterface
+ * The entity.
+ */
+ public function getEntity() {
+ return $this->entity;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Form/EntityCloneSettingsForm.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Form/EntityCloneSettingsForm.php
new file mode 100644
index 000000000..22ad1d8cc
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Form/EntityCloneSettingsForm.php
@@ -0,0 +1,133 @@
+entityCloneSettingsManager = $entity_clone_settings_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static(
+ $container->get('config.factory'),
+ $container->get('entity_clone.settings.manager')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEditableConfigNames() {
+ return ['entity_clone.settings'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFormId() {
+ return 'entity_clone_settings_form';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(array $form, FormStateInterface $form_state) {
+ $form['#tree'] = TRUE;
+
+ $form['form_settings'] = [
+ '#tree' => TRUE,
+ '#type' => 'fieldset',
+ '#title' => $this->t('Clone form settings'),
+ '#description' => $this->t("
+ For each type of child entity (the entity that's referenced by the entity being
+ cloned), please set your cloning preferences. This will affect the clone form presented to users when they
+ clone entities. Default behaviour for whether or not the child entities should be cloned is specified in
+ the left-most column. To prevent users from altering behaviour for each type when they're actually cloning
+ (but still allowing them to see what will happen), use the middle column. The right-most column can be used
+ to hide the form options from users completely. This will run the clone operation with the defaults set here
+ (in the left-most column). See the clone form (by cloning an entity) for more information.
+ "),
+ '#open' => TRUE,
+ '#collapsible' => FALSE,
+ ];
+
+ $form['form_settings']['table'] = [
+ '#type' => 'table',
+ '#header' => [
+ 'label' => $this->t('Label'),
+ 'default_value' => $this->t('Checkboxes default value'),
+ 'disable' => $this->t('Disable checkboxes'),
+ 'hidden' => $this->t('Hide checkboxes'),
+ ],
+ ];
+
+ foreach ($this->entityCloneSettingsManager->getContentEntityTypes() as $type_id => $type) {
+ $form['form_settings']['table'][$type_id] = [
+ 'label' => [
+ '#type' => 'label',
+ '#title' => $this->t('@type', [
+ '@type' => $type->getLabel(),
+ ]),
+ ],
+ 'default_value' => [
+ '#type' => 'checkbox',
+ '#default_value' => $this->entityCloneSettingsManager->getDefaultValue($type_id),
+ ],
+ 'disable' => [
+ '#type' => 'checkbox',
+ '#default_value' => $this->entityCloneSettingsManager->getDisableValue($type_id),
+ ],
+ 'hidden' => [
+ '#type' => 'checkbox',
+ '#default_value' => $this->entityCloneSettingsManager->getHiddenValue($type_id),
+ ],
+ ];
+ }
+
+ $form['take_ownership'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Take ownership'),
+ '#description' => $this->t('Whether the "Take ownership" option should be checked by default on the entity clone form.'),
+ '#default_value' => $this->entityCloneSettingsManager->getTakeOwnershipSetting(),
+ ];
+
+ return parent::buildForm($form, $form_state);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function submitForm(array &$form, FormStateInterface $form_state) {
+ $this->entityCloneSettingsManager->setFormSettings($form_state->getValue('form_settings'));
+ $this->entityCloneSettingsManager->setTakeOwnershipSettings($form_state->getValue('take_ownership'));
+ parent::submitForm($form, $form_state);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Plugin/Derivative/DynamicLocalTasks.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Plugin/Derivative/DynamicLocalTasks.php
new file mode 100644
index 000000000..5dd716bb9
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Plugin/Derivative/DynamicLocalTasks.php
@@ -0,0 +1,77 @@
+entityTypeManager = $entity_type_manager;
+ $this->translationManager = $string_translation;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container, $base_plugin_id) {
+ return new static(
+ $container->get('entity_type.manager'),
+ $container->get('string_translation')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDerivativeDefinitions($base_plugin_definition) {
+ $this->derivatives = [];
+
+ /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */
+ foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
+ $has_clone_path = $entity_type->hasLinkTemplate('clone-form');
+ $has_canonical_path = $entity_type->hasLinkTemplate('canonical');
+
+ if ($has_clone_path) {
+ $this->derivatives["$entity_type_id.clone_tab"] = [
+ 'route_name' => "entity.$entity_type_id.clone_form",
+ 'title' => $this->translationManager->translate('Clone'),
+ 'base_route' => "entity.$entity_type_id." . ($has_canonical_path ? "canonical" : "edit_form"),
+ 'weight' => 100,
+ ];
+ }
+ }
+
+ return $this->derivatives;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Routing/RouteSubscriber.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Routing/RouteSubscriber.php
new file mode 100644
index 000000000..5c892ee51
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Routing/RouteSubscriber.php
@@ -0,0 +1,95 @@
+entityTypeManager = $entity_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterRoutes(RouteCollection $collection) {
+ foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
+ if ($route = $this->getEntityCloneRoute($entity_type)) {
+ $collection->add("entity.$entity_type_id.clone_form", $route);
+ }
+ }
+ }
+
+ /**
+ * Gets the entity_clone route.
+ *
+ * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
+ * The entity type.
+ *
+ * @return \Symfony\Component\Routing\Route|null
+ * The generated route, if available.
+ */
+ protected function getEntityCloneRoute(EntityTypeInterface $entity_type) {
+ if ($clone_form = $entity_type->getLinkTemplate('clone-form')) {
+ $entity_type_id = $entity_type->id();
+ $route = new Route($clone_form);
+ $route
+ ->addDefaults([
+ '_form' => '\Drupal\entity_clone\Form\EntityCloneForm',
+ '_title' => 'Clone ' . $entity_type->getLabel(),
+ ])
+ ->addRequirements([
+ '_entity_access' => $entity_type_id . '.clone',
+ ])
+ ->setOption('_entity_clone_entity_type_id', $entity_type_id)
+ ->setOption('_admin_route', TRUE)
+ ->setOption('parameters', [
+ $entity_type_id => ['type' => 'entity:' . $entity_type_id],
+ ]);
+
+ // Special case for menu link content.
+ // Menu link content does not work properly with custom operation.
+ // This case must be removed when issue #3016038
+ // (https://www.drupal.org/project/drupal/issues/3016038) was closed.
+ if ($entity_type_id === 'menu_link_content') {
+ $route->setRequirements([
+ '_permission' => 'clone ' . $entity_type_id . ' entity',
+ ]);
+ }
+
+ return $route;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events = parent::getSubscribedEvents();
+ $events[RoutingEvents::ALTER] = 'onAlterRoutes';
+ return $events;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/src/Services/EntityCloneServiceProvider.php b/frontend/drupal9/web/modules/contrib/entity_clone/src/Services/EntityCloneServiceProvider.php
new file mode 100644
index 000000000..8f9f04d11
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/src/Services/EntityCloneServiceProvider.php
@@ -0,0 +1,39 @@
+getOriginalClass());
+ } catch (\ReflectionException $e) {
+ return FALSE;
+ }
+ return in_array(
+ EntityOwnerTrait::class,
+ array_keys($reflectionClass->getTraits())
+ );
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneActionTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneActionTest.php
new file mode 100644
index 000000000..601dd9b39
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneActionTest.php
@@ -0,0 +1,97 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test action entity clone.
+ */
+ public function testActionEntityClone() {
+ foreach (\Drupal::service('plugin.manager.action')->getDefinitions() as $id => $definition) {
+ if (is_subclass_of($definition['class'], '\Drupal\Core\Plugin\PluginFormInterface') && $definition['label'] == 'Send email') {
+ $action_key = $id;
+ break;
+ }
+ }
+
+ $edit = [
+ 'label' => 'Test send email action for clone',
+ 'id' => 'test_send_email_for_clone',
+ 'recipient' => 'test@recipient.com',
+ 'subject' => 'test subject',
+ 'message' => 'test message',
+ ];
+ $this->drupalPostForm("admin/config/system/actions/add/$action_key", $edit, t('Save'));
+
+ $actions = \Drupal::entityTypeManager()
+ ->getStorage('action')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $action = reset($actions);
+
+ $edit = [
+ 'label' => 'Test send email action cloned',
+ 'id' => 'test_send_email_cloned',
+ ];
+ $this->drupalPostForm('entity_clone/action/' . $action->id(), $edit, t('Clone'));
+
+ $actions = \Drupal::entityTypeManager()
+ ->getStorage('action')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $action = reset($actions);
+ $this->assertInstanceOf(Action::class, $action, 'Test action cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneBlockTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneBlockTest.php
new file mode 100644
index 000000000..139c528ef
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneBlockTest.php
@@ -0,0 +1,85 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test block entity clone.
+ */
+ public function testBlockEntityClone() {
+ $config = \Drupal::configFactory();
+ $block = Block::create([
+ 'plugin' => 'test_block',
+ 'region' => 'sidebar_first',
+ 'id' => 'test_block',
+ 'theme' => $config->get('system.theme')->get('default'),
+ 'label' => $this->randomMachineName(8),
+ 'visibility' => [],
+ 'weight' => 0,
+ ]);
+ $block->save();
+
+ $edit = [
+ 'id' => 'test_block_cloned',
+ ];
+ $this->drupalPostForm('entity_clone/block/' . $block->id(), $edit, t('Clone'));
+
+ $blocks = \Drupal::entityTypeManager()
+ ->getStorage('block')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $block = reset($blocks);
+ $this->assertInstanceOf(Block::class, $block, 'Test block cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCommentTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCommentTest.php
new file mode 100644
index 000000000..747014206
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCommentTest.php
@@ -0,0 +1,88 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test comment entity clone.
+ */
+ public function testCommentEntityClone() {
+ $subject = 'Test comment for clone';
+ $body = $this->randomMachineName();
+ $comment = $this->postComment($this->node, $body, $subject, TRUE);
+
+ $this->drupalPostForm('entity_clone/comment/' . $comment->id(), [], t('Clone'));
+
+ $comments = \Drupal::entityTypeManager()
+ ->getStorage('comment')
+ ->loadByProperties([
+ 'subject' => $subject . ' - Cloned',
+ 'comment_body' => $body,
+ ]);
+ $comments = reset($comments);
+ $this->assertInstanceOf(Comment::class, $comments, 'Test comment cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContactTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContactTest.php
new file mode 100644
index 000000000..1d2961193
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContactTest.php
@@ -0,0 +1,96 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test contact form entity clone.
+ */
+ public function testContactFormsEntityClone() {
+
+ $edit = [
+ 'label' => 'Test contact form for clone',
+ 'id' => 'test_contact_form_for_clone',
+ 'recipients' => 'test@recipient.com',
+ ];
+ $this->drupalPostForm('admin/structure/contact/add', $edit, t('Save'));
+
+ $contact_forms = \Drupal::entityTypeManager()
+ ->getStorage('contact_form')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $contact_form = reset($contact_forms);
+
+ $edit = [
+ 'label' => 'Test contact form cloned',
+ 'id' => 'test_contact_form_cloned',
+ ];
+ $this->drupalPostForm('entity_clone/contact_form/' . $contact_form->id(), $edit, t('Clone'));
+
+ $contact_forms = \Drupal::entityTypeManager()
+ ->getStorage('contact_form')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $contact_form = reset($contact_forms);
+ $this->assertInstanceOf(ContactForm::class, $contact_form, 'Test contact form cloned found in database.');
+
+ $edit = [
+ 'id' => 'test_contact_form_clone_with_a_really_long_name_that_is_longer_than_the_bundle_max_length',
+ 'label' => 'Test contact form clone with a really long name that is longer than the bundle max length',
+ ];
+ $this->drupalPostForm('entity_clone/contact_form/' . $contact_form->id(), $edit, t('Clone'));
+ $this->assertText('New Id cannot be longer than 32 characters');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentCreatedDate.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentCreatedDate.php
new file mode 100644
index 000000000..4e1516355
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentCreatedDate.php
@@ -0,0 +1,81 @@
+sutUser = $this->drupalCreateUser([
+ 'bypass node access',
+ 'administer nodes',
+ 'clone node entity',
+ ]);
+ }
+
+ /**
+ * Test that an entity's created date is not cloned.
+ */
+ public function testCreatedDateIsNotCloned() {
+ // Log in.
+ $this->drupalLogin($this->sutUser);
+
+ // Create the original node.
+ $originalNodeCreatedDate = new \DateTimeImmutable('1 year 1 month 1 day ago');
+ $originalNode = $this->drupalCreateNode([
+ 'created' => $originalNodeCreatedDate->getTimestamp(),
+ ]);
+ $this->assertEquals($originalNodeCreatedDate->getTimestamp(), $originalNode->getCreatedTime());
+
+ // Clone the node.
+ $this->drupalGet(Url::fromRoute('entity.node.clone_form', [
+ 'node' => $originalNode->id(),
+ ])->toString());
+ $this->getSession()->getPage()->pressButton('Clone');
+
+ // Find the cloned node.
+ $originalNodeClones = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => sprintf('%s - Cloned', $originalNode->label()),
+ ]);
+ $this->assertGreaterThanOrEqual(1, count($originalNodeClones));
+ $clonedNode = reset($originalNodeClones);
+
+ // Validate the cloned node's created time is more recent than the original
+ // node.
+ $this->assertNotEquals($originalNode->getCreatedTime(), $clonedNode->getCreatedTime());
+ $this->assertGreaterThanOrEqual($originalNode->getCreatedTime(), $clonedNode->getCreatedTime());
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveCircularTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveCircularTest.php
new file mode 100644
index 000000000..71f37d819
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveCircularTest.php
@@ -0,0 +1,194 @@
+drupalCreateContentType([
+ 'type' => 'test_content_type',
+ 'name' => 'Test content type',
+ 'display_submitted' => FALSE,
+ ]);
+
+ $this->createEntityReferenceField('node', 'test_content_type', 'test_field_reference', 'Test field reference', 'node');
+ $this->createEntityReferenceField('node', 'test_content_type', 'test_another_field_reference', 'Test another field reference', 'node');
+
+ $this->adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test clone a content entity with another entities attached.
+ */
+ public function testContentEntityClone() {
+
+ $node1_title = $this->randomMachineName(8);
+ $node1 = Node::create([
+ 'type' => 'test_content_type',
+ 'title' => $node1_title,
+ ]);
+ $node1->save();
+
+ $node2_title = $this->randomMachineName(8);
+ $node2 = Node::create([
+ 'type' => 'test_content_type',
+ 'title' => $node2_title,
+ 'test_field_reference' => $node1,
+ ]);
+ $node2->save();
+
+ $node1->set('test_field_reference', $node2->id());
+ $node1->save();
+
+ $settings = [
+ 'node' => [
+ 'default_value' => 1,
+ 'disable' => 0,
+ 'hidden' => 0,
+ ],
+ ];
+ \Drupal::service('config.factory')->getEditable('entity_clone.settings')->set('form_settings', $settings)->save();
+
+ $this->drupalPostForm('entity_clone/node/' . $node1->id(), [], t('Clone'));
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node1_title . ' - Cloned',
+ ]);
+ /** @var \Drupal\node\Entity\Node $node1cloned */
+ $node1cloned = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node1cloned, 'Node 1 cloned found in database.');
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node2_title . ' - Cloned',
+ ]);
+ /** @var \Drupal\node\Entity\Node $node2cloned */
+ $node2cloned = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node2cloned, 'Node 2 cloned found in database.');
+
+ $reference = $node2cloned->get('test_field_reference')->first()->get('entity')->getTarget()->getValue();
+ $this->assertEquals($node1cloned->id(), $reference->id(), "Node 1 reference, from circular reference, is correctly referenced.");
+
+ $node1cloned->delete();
+ $node2cloned->delete();
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node1_title,
+ ]);
+ $node = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node, 'Test original node 1 found in database.');
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node2_title,
+ ]);
+ $node = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node, 'Test original node 2 found in database.');
+ }
+
+ public function testContentWithTwoSameEntityReference() {
+ $child_node1_title = $this->randomMachineName(8);
+ $child_node1 = Node::create([
+ 'type' => 'test_content_type',
+ 'title' => $child_node1_title,
+ ]);
+ $child_node1->save();
+
+ $parent_node_title = $this->randomMachineName(8);
+ $parent_node = Node::create([
+ 'type' => 'test_content_type',
+ 'title' => $parent_node_title,
+ 'test_field_reference' => $child_node1,
+ 'test_another_field_reference' => $child_node1,
+ ]);
+ $parent_node->save();
+
+ $settings = [
+ 'node' => [
+ 'default_value' => 0,
+ 'disable' => 0,
+ 'hidden' => 0,
+ ],
+ ];
+ \Drupal::service('config.factory')->getEditable('entity_clone.settings')->set('form_settings', $settings)->save();
+
+ $this->drupalPostForm('entity_clone/node/' . $parent_node->id(), [], t('Clone'));
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $parent_node_title . ' - Cloned',
+ ]);
+ /** @var \Drupal\node\Entity\Node $parent_node_cloned */
+ $parent_node_cloned = reset($nodes);
+
+ $this->drupalGet('node/' . $parent_node_cloned->id());
+
+ $first_reference = $parent_node_cloned->get('test_field_reference')->first()->get('entity')->getTarget()->getValue();
+ $second_reference = $parent_node_cloned->get('test_another_field_reference')->first()->get('entity')->getTarget()->getValue();
+ $this->assertEquals($child_node1->id(), $first_reference->id(), "Entity referenced twice time is correctly reused.");
+ $this->assertEquals($child_node1->id(), $second_reference->id(), "Entity referenced twice time is correctly reused.");
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveTest.php
new file mode 100644
index 000000000..872b7a6ef
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentRecursiveTest.php
@@ -0,0 +1,137 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test clone a content entity with another entities attached.
+ */
+ public function testContentEntityClone() {
+
+ $term_title = $this->randomMachineName(8);
+ $term = Term::create([
+ 'vid' => 'tags',
+ 'name' => $term_title,
+ ]);
+ $term->save();
+
+ $node_title = $this->randomMachineName(8);
+ $node = Node::create([
+ 'type' => 'article',
+ 'title' => $node_title,
+ 'field_tags' => [
+ 'target_id' => $term->id(),
+ ],
+ ]);
+ $node->save();
+
+ $settings = [
+ 'taxonomy_term' => [
+ 'default_value' => 1,
+ 'disable' => 0,
+ 'hidden' => 0,
+ ],
+ ];
+ \Drupal::service('config.factory')->getEditable('entity_clone.settings')->set('form_settings', $settings)->save();
+
+ $this->drupalPostForm('entity_clone/node/' . $node->id(), [
+ 'recursive[node.article.field_tags][references][' . $term->id() . '][clone]' => 1,
+ ], t('Clone'));
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node_title . ' - Cloned',
+ ]);
+ /** @var \Drupal\node\Entity\Node $node */
+ $node = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node, 'Test node cloned found in database.');
+
+ $terms = \Drupal::entityTypeManager()
+ ->getStorage('taxonomy_term')
+ ->loadByProperties([
+ 'name' => $term_title . ' - Cloned',
+ ]);
+ /** @var \Drupal\taxonomy\Entity\Term $term */
+ $term = reset($terms);
+ $this->assertInstanceOf(Term::class, $term, 'Test term referenced by node cloned too found in database.');
+
+ $node->delete();
+ $term->delete();
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node_title,
+ ]);
+ $node = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node, 'Test original node found in database.');
+
+ $terms = \Drupal::entityTypeManager()
+ ->getStorage('taxonomy_term')
+ ->loadByProperties([
+ 'name' => $term_title,
+ ]);
+ $term = reset($terms);
+ $this->assertInstanceOf(Term::class, $term, 'Test original term found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentTest.php
new file mode 100644
index 000000000..384e95145
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentTest.php
@@ -0,0 +1,96 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test content entity clone.
+ */
+ public function testContentEntityClone() {
+ $node_title = $this->randomMachineName(8);
+ $node = Node::create([
+ 'type' => 'page',
+ 'title' => $node_title,
+ ]);
+ $node->save();
+
+ $this->drupalPostForm('entity_clone/node/' . $node->id(), [], t('Clone'));
+
+ $nodes = \Drupal::entityTypeManager()
+ ->getStorage('node')
+ ->loadByProperties([
+ 'title' => $node_title . ' - Cloned',
+ ]);
+ $node = reset($nodes);
+ $this->assertInstanceOf(Node::class, $node, 'Test node cloned found in database.');
+ }
+
+ public function testContentReferenceConfigEntity() {
+ $this->createEntityReferenceField('node', 'page', 'config_field_reference', 'Config field reference', 'taxonomy_vocabulary');
+
+ $node_title = $this->randomMachineName(8);
+ $node = Node::create([
+ 'type' => 'page',
+ 'title' => $node_title,
+ 'config_field_reference' => 'tags'
+ ]);
+ $node->save();
+
+ $this->drupalGet('entity_clone/node/' . $node->id());
+ $this->assertSession()->elementNotExists('css', '#edit-recursive-nodepageconfig-field-reference');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCustomBlockTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCustomBlockTest.php
new file mode 100644
index 000000000..34292d3d6
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneCustomBlockTest.php
@@ -0,0 +1,76 @@
+drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test custom block entity clone.
+ */
+ public function testCustomBlockEntityClone() {
+
+ $edit = [];
+ $edit['info[0][value]'] = 'Test block ready to clone';
+ $edit['body[0][value]'] = $this->randomMachineName(16);
+ $this->drupalPostForm('block/add/basic', $edit, t('Save'));
+
+ $blocks = \Drupal::entityTypeManager()
+ ->getStorage('block_content')
+ ->loadByProperties([
+ 'info' => $edit['info[0][value]'],
+ ]);
+ $block = reset($blocks);
+ $this->assertInstanceOf(BlockContent::class, $block, 'Test Block for clone found in database.');
+
+ $this->drupalPostForm('entity_clone/block_content/' . $block->id(), [], t('Clone'));
+
+ $blocks = \Drupal::entityTypeManager()
+ ->getStorage('block_content')
+ ->loadByProperties([
+ 'info' => $edit['info[0][value]'] . ' - Cloned',
+ 'body' => $edit['body[0][value]'],
+ ]);
+ $block = reset($blocks);
+ $this->assertInstanceOf(BlockContent::class, $block, 'Test Block cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneDateFormatTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneDateFormatTest.php
new file mode 100644
index 000000000..34acea668
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneDateFormatTest.php
@@ -0,0 +1,88 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test date format entity clone.
+ */
+ public function testDateFormatEntityClone() {
+ $edit = [
+ 'label' => 'Test date format for clone',
+ 'id' => 'test_date_format_for_clone',
+ 'date_format_pattern' => 'Y m d',
+ ];
+ $this->drupalPostForm("admin/config/regional/date-time/formats/add", $edit, t('Add format'));
+
+ $date_formats = \Drupal::entityTypeManager()
+ ->getStorage('date_format')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $date_format = reset($date_formats);
+
+ $edit = [
+ 'id' => 'test_date_format_cloned',
+ 'label' => 'Test date format cloned',
+ ];
+ $this->drupalPostForm('entity_clone/date_format/' . $date_format->id(), $edit, t('Clone'));
+
+ $date_formats = \Drupal::entityTypeManager()
+ ->getStorage('date_format')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $date_format = reset($date_formats);
+ $this->assertInstanceOf(DateFormat::class, $date_format, 'Test date format cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityFormModeTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityFormModeTest.php
new file mode 100644
index 000000000..a310ab0cc
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityFormModeTest.php
@@ -0,0 +1,82 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test entity form mode entity clone.
+ */
+ public function testEntityFormModeEntityClone() {
+ $entity_form_modes = \Drupal::entityTypeManager()
+ ->getStorage('entity_form_mode')
+ ->loadByProperties([
+ 'id' => 'user.register',
+ ]);
+ $entity_form_mode = reset($entity_form_modes);
+
+ $edit = [
+ 'label' => 'User register cloned form mode',
+ 'id' => 'register_clone',
+ ];
+ $this->drupalPostForm('entity_clone/entity_form_mode/' . $entity_form_mode->id(), $edit, t('Clone'));
+
+ $entity_form_modes = \Drupal::entityTypeManager()
+ ->getStorage('entity_form_mode')
+ ->loadByProperties([
+ 'id' => 'user.' . $edit['id'],
+ ]);
+ $entity_form_mode = reset($entity_form_modes);
+ $this->assertInstanceOf(EntityFormMode::class, $entity_form_mode, 'Test entity form mode cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityViewModeTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityViewModeTest.php
new file mode 100644
index 000000000..a06b4e702
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneEntityViewModeTest.php
@@ -0,0 +1,82 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test entity view mode entity clone.
+ */
+ public function testEntityViewModeEntityClone() {
+ $entity_view_modes = \Drupal::entityTypeManager()
+ ->getStorage('entity_view_mode')
+ ->loadByProperties([
+ 'id' => 'user.full',
+ ]);
+ $entity_view_mode = reset($entity_view_modes);
+
+ $edit = [
+ 'label' => 'User full cloned view mode',
+ 'id' => 'register_clone',
+ ];
+ $this->drupalPostForm('entity_clone/entity_view_mode/' . $entity_view_mode->id(), $edit, t('Clone'));
+
+ $entity_view_modes = \Drupal::entityTypeManager()
+ ->getStorage('entity_view_mode')
+ ->loadByProperties([
+ 'id' => 'user.' . $edit['id'],
+ ]);
+ $entity_view_mode = reset($entity_view_modes);
+ $this->assertInstanceOf(EntityViewMode::class, $entity_view_mode, 'Test entity view mode cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFileTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFileTest.php
new file mode 100644
index 000000000..b6e688234
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFileTest.php
@@ -0,0 +1,82 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test file entity clone.
+ */
+ public function testFileEntityClone() {
+ /** @var \Drupal\file\FileInterface $file */
+ $file = File::create([
+ 'uid' => 1,
+ 'filename' => 'druplicon.txt',
+ 'uri' => 'public://druplicon.txt',
+ 'filemime' => 'text/plain',
+ 'status' => FILE_STATUS_PERMANENT,
+ ]);
+ file_put_contents($file->getFileUri(), 'hello world');
+ $file->save();
+
+ $this->drupalPostForm('entity_clone/file/' . $file->id(), [], t('Clone'));
+
+ $files = \Drupal::entityTypeManager()
+ ->getStorage('file')
+ ->loadByProperties([
+ 'filename' => 'druplicon.txt - Cloned',
+ ]);
+ $file = reset($files);
+ $this->assertInstanceOf(File::class, $file, 'Test file cloned found in database.');
+
+ $this->assertEqual($file->getFileUri(), 'public://druplicon_0.txt', 'The stored file is also cloned.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFilterFormatTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFilterFormatTest.php
new file mode 100644
index 000000000..03411ec7a
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneFilterFormatTest.php
@@ -0,0 +1,89 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test filter format entity clone.
+ */
+ public function testFilterFormatEntityClone() {
+ $edit = [
+ 'name' => 'Test filter format for clone',
+ 'format' => 'test_filter_format_for_clone',
+ ];
+ $this->drupalPostForm("admin/config/content/formats/add", $edit, t('Save configuration'));
+
+ $filter_formats = \Drupal::entityTypeManager()
+ ->getStorage('filter_format')
+ ->loadByProperties([
+ 'format' => $edit['format'],
+ ]);
+ $filter_format = reset($filter_formats);
+
+ $edit = [
+ 'id' => 'test_filter_format_cloned',
+ 'label' => 'Test filter format cloned',
+ ];
+ $this->drupalPostForm('entity_clone/filter_format/' . $filter_format->id(), $edit, t('Clone'));
+
+ $filter_formats = \Drupal::entityTypeManager()
+ ->getStorage('filter_format')
+ ->loadByProperties([
+ 'format' => $edit['id'],
+ ]);
+ $filter_format = reset($filter_formats);
+ $this->assertInstanceOf(FilterFormat::class, $filter_format, 'Test filter format cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneImageStyleTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneImageStyleTest.php
new file mode 100644
index 000000000..30ebf2f57
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneImageStyleTest.php
@@ -0,0 +1,94 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test image style entity clone.
+ */
+ public function testImageStyleEntityClone() {
+ $edit = [
+ 'label' => 'Test image style for clone',
+ 'name' => 'test_image_style_for_clone',
+ ];
+ $this->drupalPostForm("admin/config/media/image-styles/add", $edit, t('Create new style'));
+
+ $image_styles = \Drupal::entityTypeManager()
+ ->getStorage('image_style')
+ ->loadByProperties([
+ 'name' => $edit['name'],
+ ]);
+ $image_style = reset($image_styles);
+
+ $edit = [
+ 'id' => 'test_iamge_style_cloned',
+ 'label' => 'Test image_style cloned',
+ ];
+ $this->drupalPostForm('entity_clone/image_style/' . $image_style->id(), $edit, t('Clone'));
+
+ $image_styles = \Drupal::entityTypeManager()
+ ->getStorage('image_style')
+ ->loadByProperties([
+ 'name' => $edit['id'],
+ ]);
+ $image_style = reset($image_styles);
+ $this->assertInstanceOf(ImageStyle::class, $image_style, 'Test image style cloned found in database.');
+
+ $edit = [
+ 'id' => 'test_image_style_clone_with_a_really_long_name_that_is_longer_than_the_max_length',
+ 'label' => 'Test image style clone with a really long name that is longer than the max length',
+ ];
+ $this->drupalPostForm('entity_clone/image_style/' . $image_style->id(), $edit, t('Clone'));
+ $this->assertText('New Id cannot be longer than 64 characters');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneLanguageTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneLanguageTest.php
new file mode 100644
index 000000000..0b3a416e1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneLanguageTest.php
@@ -0,0 +1,86 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test language entity clone.
+ */
+ public function testLanguageEntityClone() {
+ $edit = [
+ 'predefined_langcode' => 'fr',
+ ];
+ $this->drupalPostForm("/admin/config/regional/language/add", $edit, t('Add language'));
+
+ $languages = \Drupal::entityTypeManager()
+ ->getStorage('configurable_language')
+ ->loadByProperties([
+ 'id' => 'fr',
+ ]);
+ $language = reset($languages);
+
+ $edit = [
+ 'id' => 'test_language_cloned',
+ 'label' => 'French language cloned',
+ ];
+ $this->drupalPostForm('entity_clone/configurable_language/' . $language->id(), $edit, t('Clone'));
+
+ $languages = \Drupal::entityTypeManager()
+ ->getStorage('configurable_language')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $language = reset($languages);
+ $this->assertInstanceOf(ConfigurableLanguage::class, $language, 'Test language cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneMenuTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneMenuTest.php
new file mode 100644
index 000000000..3a67d1bf3
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneMenuTest.php
@@ -0,0 +1,82 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test menu entity clone.
+ */
+ public function testMenuEntityClone() {
+
+ $menus = \Drupal::entityTypeManager()
+ ->getStorage('menu')
+ ->loadByProperties([
+ 'id' => 'account',
+ ]);
+ $menu = reset($menus);
+
+ $edit = [
+ 'label' => 'Test menu cloned',
+ 'id' => 'test-menu-cloned',
+ ];
+ $this->drupalPostForm('entity_clone/menu/' . $menu->id(), $edit, t('Clone'));
+
+ $menus = \Drupal::entityTypeManager()
+ ->getStorage('menu')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $menu = reset($menus);
+ $this->assertInstanceOf(Menu::class, $menu, 'Test menu cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneResponsiveImageStyleTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneResponsiveImageStyleTest.php
new file mode 100644
index 000000000..b3880c7ed
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneResponsiveImageStyleTest.php
@@ -0,0 +1,89 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test responsive image style entity clone.
+ */
+ public function testResponsiveImageStyleEntityClone() {
+ $edit = [
+ 'label' => 'Test responsive image style for clone',
+ 'id' => 'test_responsive_image_style_for_clone',
+ 'breakpoint_group' => 'responsive_image',
+ 'fallback_image_style' => 'large',
+ ];
+ $this->drupalPostForm("admin/config/media/responsive-image-style/add", $edit, t('Save'));
+
+ $responsive_image_styles = \Drupal::entityTypeManager()
+ ->getStorage('responsive_image_style')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $responsive_image_style = reset($responsive_image_styles);
+
+ $edit = [
+ 'id' => 'test_responsive_image_style_cloned',
+ 'label' => 'Test responsive image style cloned',
+ ];
+ $this->drupalPostForm('entity_clone/responsive_image_style/' . $responsive_image_style->id(), $edit, t('Clone'));
+
+ $responsive_image_styles = \Drupal::entityTypeManager()
+ ->getStorage('responsive_image_style')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $responsive_image_style = reset($responsive_image_styles);
+ $this->assertInstanceOf(ResponsiveImageStyle::class, $responsive_image_style, 'Test responsive image style cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneRoleTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneRoleTest.php
new file mode 100644
index 000000000..45fb551f5
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneRoleTest.php
@@ -0,0 +1,87 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test role entity clone.
+ */
+ public function testRoleEntityClone() {
+ $edit = [
+ 'label' => 'Test role for clone',
+ 'id' => 'test_role_for_clone',
+ ];
+ $this->drupalPostForm("/admin/people/roles/add", $edit, t('Save'));
+
+ $roles = \Drupal::entityTypeManager()
+ ->getStorage('user_role')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $role = reset($roles);
+
+ $edit = [
+ 'id' => 'test_role_cloned',
+ 'label' => 'Test role cloned',
+ ];
+ $this->drupalPostForm('entity_clone/user_role/' . $role->id(), $edit, t('Clone'));
+
+ $roles = \Drupal::entityTypeManager()
+ ->getStorage('user_role')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $role = reset($roles);
+ $this->assertInstanceOf(Role::class, $role, 'Test role cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneSearchPageTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneSearchPageTest.php
new file mode 100644
index 000000000..56d6688ea
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneSearchPageTest.php
@@ -0,0 +1,88 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test search page entity clone.
+ */
+ public function testSearchPageEntityClone() {
+ $edit = [
+ 'label' => 'Test search page for clone',
+ 'id' => 'test_search_page_for_clone',
+ 'path' => 'test_search_page_for_clone_url',
+ ];
+ $this->drupalPostForm("/admin/config/search/pages/add/node_search", $edit, t('Save'));
+
+ $search_pages = \Drupal::entityTypeManager()
+ ->getStorage('search_page')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $search_page = reset($search_pages);
+
+ $edit = [
+ 'id' => 'test_search_page_cloned',
+ 'label' => 'Test search page cloned',
+ ];
+ $this->drupalPostForm('entity_clone/search_page/' . $search_page->id(), $edit, t('Clone'));
+
+ $search_pages = \Drupal::entityTypeManager()
+ ->getStorage('search_page')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $search_page = reset($search_pages);
+ $this->assertInstanceOf(SearchPage::class, $search_page, 'Test search page cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneShortcutSetTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneShortcutSetTest.php
new file mode 100644
index 000000000..017d2673c
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneShortcutSetTest.php
@@ -0,0 +1,73 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test shortcut set entity clone.
+ */
+ public function testShortcutSetEntityClone() {
+ $edit = [
+ 'id' => 'test_shortcut_set_cloned',
+ 'label' => 'Test shortcut set cloned',
+ ];
+ $this->drupalPostForm('entity_clone/shortcut_set/default', $edit, t('Clone'));
+
+ $shortcut_sets = \Drupal::entityTypeManager()
+ ->getStorage('shortcut_set')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $shortcut_set = reset($shortcut_sets);
+ $this->assertInstanceOf(ShortcutSet::class, $shortcut_set, 'Test default shortcut set cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneUserTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneUserTest.php
new file mode 100644
index 000000000..330ff04a0
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneUserTest.php
@@ -0,0 +1,69 @@
+adminUser = $this->drupalCreateUser($this->permissions, 'test_user');
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test user entity clone.
+ */
+ public function testUserEntityClone() {
+ $this->drupalPostForm('entity_clone/user/' . $this->adminUser->id(), [], t('Clone'));
+
+ $users = \Drupal::entityTypeManager()
+ ->getStorage('user')
+ ->loadByProperties([
+ 'name' => 'test_user_cloned',
+ ]);
+ $user = reset($users);
+ $this->assertInstanceOf(User::class, $user, 'Test user cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneViewTest.php b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneViewTest.php
new file mode 100644
index 000000000..be26c1bae
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/entity_clone/tests/src/Functional/EntityCloneViewTest.php
@@ -0,0 +1,73 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test view entity clone.
+ */
+ public function testViewEntityClone() {
+ $edit = [
+ 'id' => 'test_view_cloned',
+ 'label' => 'Test view cloned',
+ ];
+ $this->drupalPostForm('entity_clone/view/who_s_new', $edit, t('Clone'));
+
+ $views = \Drupal::entityTypeManager()
+ ->getStorage('view')
+ ->loadByProperties([
+ 'id' => $edit['id'],
+ ]);
+ $view = reset($views);
+ $this->assertInstanceOf(View::class, $view, 'Test default view cloned found in database.');
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/google_analytics.services.yml b/frontend/drupal9/web/modules/contrib/google_analytics/google_analytics.services.yml
new file mode 100644
index 000000000..f14dbd6f3
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/google_analytics.services.yml
@@ -0,0 +1,47 @@
+services:
+ google_analytics.visibility:
+ class: Drupal\google_analytics\Helpers\VisiblityTracker
+ arguments: [ '@config.factory', '@path_alias.manager', '@path.matcher', '@user.data', '@path.current' ]
+ google_analytics.accounts:
+ class: Drupal\google_analytics\Helpers\GoogleAnalyticsAccounts
+ arguments: [ '@config.factory', '@private_key' ]
+ google_analytics.javascript_cache:
+ class: Drupal\google_analytics\JavascriptLocalCache
+ arguments: [ '@http_client', '@file_system', '@config.factory', '@logger.factory', '@state' ]
+
+ # Google Analytics Event Subscribers
+ google_analytics.events.messages:
+ class: '\Drupal\google_analytics\EventSubscriber\GoogleAnalyticsEvents\DrupalMessage'
+ arguments: [ '@config.factory', '@google_analytics.accounts', '@messenger' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.pagepath.content_translation:
+ class: '\Drupal\google_analytics\EventSubscriber\PagePath\ContentTranslation'
+ arguments: [ '@config.factory', '@request_stack', '@module_handler', '@entity.repository' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.pagepath.http_status:
+ class: '\Drupal\google_analytics\EventSubscriber\PagePath\HttpStatus'
+ arguments: [ '@config.factory', '@request_stack' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.pagepath.invalid_user_login:
+ class: '\Drupal\google_analytics\EventSubscriber\PagePath\InvalidUserLogin'
+ arguments: [ '@request_stack', '@current_route_match' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.pagepath.search:
+ class: '\Drupal\google_analytics\EventSubscriber\PagePath\Search'
+ arguments: [ '@config.factory', '@request_stack', '@module_handler', '@current_route_match' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.config.default_config:
+ class: '\Drupal\google_analytics\EventSubscriber\GoogleAnalyticsConfig\DefaultConfig'
+ arguments: [ '@config.factory', '@google_analytics.accounts', '@current_user' ]
+ tags:
+ - { name: 'event_subscriber' }
+ google_analytics.config.custom_config:
+ class: '\Drupal\google_analytics\EventSubscriber\GoogleAnalyticsConfig\CustomConfig'
+ arguments: [ '@config.factory', '@current_user', '@request_stack', '@token' ]
+ tags:
+ - { name: 'event_subscriber' }
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/Constants/GoogleAnalyticsEvents.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/Constants/GoogleAnalyticsEvents.php
new file mode 100644
index 000000000..aadcd8649
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/Constants/GoogleAnalyticsEvents.php
@@ -0,0 +1,65 @@
+javascript = $javascript;
+ $this->gaAccount = $ga_account;
+ }
+
+ /**
+ * Get the GA Javascript Object.
+ *
+ * @return \Drupal\google_analytics\GaJavascriptObject
+ * The GA Javascript
+ */
+ public function getJavascript() {
+ return $this->javascript;
+ }
+
+ /**
+ * Get the specific Google Analytics account associated with this config.
+ *
+ * @return \Drupal\google_analytics\Helpers\GoogleAnalyticsAccounts
+ */
+ public function getGaAccount() {
+ return $this->gaAccount;
+ }
+
+ /**
+ * Get the GA Javascript Object being created.
+ *
+ * @return array
+ * Config to be set in the GA javascript
+ */
+ public function getConfig() {
+ return $this->config;
+ }
+
+ /**
+ * Set a config key.
+ *
+ */
+ public function addConfig($config_key, $value) {
+ $this->config[$config_key] = $value;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/GoogleAnalyticsEventsEvent.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/GoogleAnalyticsEventsEvent.php
new file mode 100644
index 000000000..5de4e73d3
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/GoogleAnalyticsEventsEvent.php
@@ -0,0 +1,47 @@
+javascript = $javascript;
+ }
+
+ /**
+ * Get the GA Javascript Object being created.
+ *
+ * @return array
+ * Events in the javascript.
+ */
+ public function getEvents() {
+ return $this->javascript->getEvents();
+ }
+
+ /**
+ * Get the GA Javascript Object being created.
+ */
+ public function addEvent($event) {
+ $this->javascript->addEvent($event);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/PagePathEvent.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/PagePathEvent.php
new file mode 100644
index 000000000..ee1ac15ee
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/Event/PagePathEvent.php
@@ -0,0 +1,36 @@
+page_path;
+ }
+
+ /**
+ * Get the GA Javascript Object being created.
+ */
+ public function setPagePath($url) {
+ $this->page_path = $url;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/CustomConfig.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/CustomConfig.php
new file mode 100644
index 000000000..1ab7813c1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/CustomConfig.php
@@ -0,0 +1,154 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->currentAccount = $account;
+ $this->request = $request->getCurrentRequest();
+ $this->token = $token;
+
+ // Populate custom map/vars
+ $this->populateCustomConfig();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::ADD_CONFIG][] = ['onAddConfig'];
+ $events[GoogleAnalyticsEvents::ADD_EVENT][] = ['onAddEvent'];
+ return $events;
+ }
+
+ /**
+ * Adds a new event to the Ga Javascript
+ *
+ * @param \Drupal\google_analytics\Event\GoogleAnalyticsConfigEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onAddConfig(GoogleAnalyticsConfigEvent $event) {
+ // Don't execute event if there is nothing in the mapping fields.
+ if (empty($this->custom_map)) {
+ return;
+ }
+
+ // Only populate the config on UA accounts.
+ if ($event->getGaAccount()->isUniversalAnalyticsAccount()) {
+ $event->addConfig('custom_map', $this->custom_map['custom_map']);
+ }
+ }
+
+ public function onAddEvent(GoogleAnalyticsEventsEvent $event) {
+ // Don't execute event if there is nothing in the mapping fields.
+ if (empty($this->custom_vars)) {
+ return;
+ }
+ $event->addEvent(['custom' => $this->custom_vars]);
+ }
+
+ protected function populateCustomConfig() {
+ // Add custom dimensions and metrics.
+ $custom_parameters = $this->config->get('custom.parameters');
+ if (!empty($custom_parameters)) {
+ // Add all the configured variables to the content.
+ foreach ($custom_parameters as $index => $custom_parameter) {
+ // Replace tokens in values.
+ $types = [];
+ if ($this->request->attributes->has('node')) {
+ $node = $this->request->attributes->get('node');
+ if ($node instanceof NodeInterface) {
+ $types += ['node' => $node];
+ }
+ }
+ $custom_parameter['value'] = $this->token->replace($custom_parameter['value'], $types, ['clear' => TRUE]);
+
+ // Suppress empty values.
+ if ((isset($custom_parameter['name']) && !mb_strlen(trim($custom_parameter['name']))) || !mb_strlen(trim($custom_parameter['value']))) {
+ continue;
+ }
+
+ // Per documentation the max length of a dimension is 150 bytes.
+ // A metric has no length limitation. It's not documented if this
+ // limit means 150 bytes after url encoding or before.
+ // See https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#customs
+ if ($custom_parameter['type'] == 'dimension' && mb_strlen($custom_parameter['value']) > 150) {
+ $custom_parameter['value'] = substr($custom_parameter['value'], 0, 150);
+ }
+
+ // Cast metric values for json_encode to data type numeric.
+ if ($custom_parameter['type'] == 'metric') {
+ settype($custom_parameter['value'], 'float');
+ };
+
+ // Build the arrays of values.
+ $this->custom_map['custom_map'][$index] = ($custom_parameter['name'] ?? "");
+ if (isset($custom_parameter['name'])) {
+ $this->custom_vars[$custom_parameter['name']] = $custom_parameter['value'];
+ }
+ }
+ }
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/DefaultConfig.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/DefaultConfig.php
new file mode 100644
index 000000000..dd94fab06
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsConfig/DefaultConfig.php
@@ -0,0 +1,142 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->gaAccounts = $ga_accounts;
+ $this->currentAccount = $account;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::ADD_CONFIG][] = ['onAddConfig'];
+ return $events;
+ }
+
+ /**
+ * Adds a new event to the Ga Javascript
+ *
+ * @param \Drupal\google_analytics\Event\GoogleAnalyticsConfigEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onAddConfig(GoogleAnalyticsConfigEvent $event) {
+ $javascript = $event->getJavascript();
+ $ga_account = $event->getGaAccount();
+
+ // Custom Code Snippets that aren't created programmatically.
+ $codesnippet_parameters = $this->config->get('codesnippet.create') ?? [];
+
+ // Build the arguments fields list.
+ // https://developers.google.com/analytics/devguides/collection/gtagjs/sending-data
+ $arguments = ['groups' => 'default'];
+ $arguments = array_merge($arguments, $codesnippet_parameters);
+
+ // Domain tracking type.
+ global $cookie_domain;
+ $domain_mode = $this->config->get('domain_mode');
+
+ // Per RFC 2109, cookie domains must contain at least one dot other than the
+ // first. For hosts such as 'localhost' or IP Addresses we don't set a
+ // cookie domain.
+ if ($domain_mode == 1 && count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) {
+ $arguments = array_merge($arguments, ['cookie_domain' => $cookie_domain]);
+ $javascript->setAdsenseScript($cookie_domain);
+ }
+ elseif ($domain_mode == 2) {
+ // Cross Domain tracking
+ // https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain
+ $arguments['linker'] = [
+ 'domains' => preg_split('/(\r\n?|\n)/', $this->config->get('cross_domains')),
+ ];
+ $javascript->setAdsenseScript();
+ }
+
+ // Track logged in users across all devices.
+ if ($this->currentAccount->isAuthenticated()) {
+ $arguments['user_id'] = $this->gaAccounts->getUserIdHash($this->currentAccount->id());
+ }
+
+ // Eliminate for GA 4.x
+ if ($this->config->get('privacy.anonymizeip') && $ga_account->isUniversalAnalyticsAccount()) {
+ $arguments['anonymize_ip'] = TRUE;
+ }
+
+ $page_path = new PagePathEvent();
+ // Get the event_dispatcher service and dispatch the event.
+ $event_dispatcher = \Drupal::service('event_dispatcher');
+ $event_dispatcher->dispatch(GoogleAnalyticsEvents::PAGE_PATH, $page_path);
+
+ $path_type = $ga_account->isUniversalAnalyticsAccount() ? 'page_path' : 'page_location';
+ $arguments['page_placeholder'] = 'PLACEHOLDER_' . $path_type;
+
+ // TODO: Rewrite this into the PagePath event that executes first.
+ if ($this->config->get('track.urlfragments')) {
+ $arguments['page'] = 'location.pathname + location.search + location.hash';
+ }
+
+ if (!empty($page_path->getPagePath())) {
+ $arguments['page'] = $page_path->getPagePath();
+ }
+
+ // Add enhanced link attribution after 'create', but before 'pageview' send.
+ // @see https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-link-attribution
+ if ($this->config->get('track.linkid')) {
+ $arguments['link_attribution'] = TRUE;
+ }
+
+ // Disabling display features.
+ // @see https://developers.google.com/analytics/devguides/collection/gtagjs/display-features
+ if (!$this->config->get('track.displayfeatures')) {
+ $arguments['allow_ad_personalization_signals'] = FALSE;
+ }
+
+ foreach ($arguments as $config_key => $value) {
+ $event->addConfig($config_key, $value);
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/DrupalMessage.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/DrupalMessage.php
new file mode 100644
index 000000000..bd0b32919
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/DrupalMessage.php
@@ -0,0 +1,72 @@
+messenger = $messenger;
+ }
+
+ public function addGaEvent(): array {
+ $events = [];
+ if ($message_types = $this->ga_config->get('track.messages')) {
+ $message_types = array_values(array_filter($message_types));
+ $status_heading = [
+ 'status' => t('Status message'),
+ 'warning' => t('Warning message'),
+ 'error' => t('Error message'),
+ ];
+
+ foreach ($this->messenger->all() as $type => $messages) {
+ // Track only the selected message types.
+ if (in_array($type, $message_types)) {
+ foreach ($messages as $message) {
+ // Compatibility with 3.x and UA format.
+ if ($this->isLegacy) {
+ $events[] = [(string)$status_heading[$type] =>
+ ['event_category' => (string)t('Messages'),
+ 'event_label' => strip_tags((string) $message)
+ ]
+ ];
+ }
+ else {
+ $events[] = [(string)$status_heading[$type] =>
+ ['value' => strip_tags((string) $message)]
+ ];
+ }
+ }
+ }
+ }
+ }
+ return $events;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/GoogleAnalyticsEventBase.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/GoogleAnalyticsEventBase.php
new file mode 100644
index 000000000..ef00cadbf
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/GoogleAnalyticsEvents/GoogleAnalyticsEventBase.php
@@ -0,0 +1,85 @@
+ga_config = $config_factory->get('google_analytics.settings');
+ $this->isLegacy = $ga_accounts->getDefaultMeasurementId()->isUniversalAnalyticsAccount();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::ADD_EVENT][] =
+ ['onAddEvent', self::$priority];
+ return $events;
+ }
+
+ /**
+ * Adds a new event in an array format for UA or GA4.
+ *
+ * @return array
+ */
+ abstract public function addGaEvent(): array;
+
+ /**
+ * Adds a new event to the Ga Javascript
+ *
+ * @param \Drupal\google_analytics\Event\GoogleAnalyticsEventsEvent $event
+ * The event being dispatched.
+ */
+ public function onAddEvent(GoogleAnalyticsEventsEvent $event) {
+ $ga_events = $this->addGaEvent();
+ if (!empty($ga_events)) {
+ foreach($ga_events AS $ga_event) {
+ $event->addEvent($ga_event);
+ }
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/ContentTranslation.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/ContentTranslation.php
new file mode 100644
index 000000000..4cde9ecbb
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/ContentTranslation.php
@@ -0,0 +1,101 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->request = $request->getCurrentRequest();
+ $this->moduleHandler = $module_handler;
+ $this->entityRepository = $entity_repsoitory;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::PAGE_PATH][] = ['onPagePath'];
+ return $events;
+ }
+
+ /**
+ * Adds a new event to the Ga Javascript
+ *
+ * @param \Drupal\google_analytics\Event\PagePathEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onPagePath(PagePathEvent $event) {
+ // Site search tracking support.
+ // If this node is a translation of another node, pass the original
+ // node instead.
+ if ($this->moduleHandler->moduleExists('content_translation') && $this->config->get('translation_set')) {
+ // Check if we have a node object, it has translation enabled, and its
+ // language code does not match its source language code.
+ if ($this->request->attributes->has('node')) {
+ $node = $this->request->attributes->get('node');
+ if ($node instanceof NodeInterface && $this->entityRepository->getTranslationFromContext($node) !== $node->getUntranslated()) {
+ $url_custom = Json::encode(Url::fromRoute('entity.node.canonical', ['node' => $node->id()], ['language' => $node->getUntranslated()->language()])->toString());
+ $event->setPagePath($url_custom);
+ $event->stopPropagation();
+ }
+ }
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/HttpStatus.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/HttpStatus.php
new file mode 100644
index 000000000..87c290ed8
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/HttpStatus.php
@@ -0,0 +1,76 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->request = $request->getCurrentRequest();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::PAGE_PATH][] = ['onPagePath'];
+ return $events;
+ }
+
+ /**
+ * Adds error pages to the page path.
+ *
+ * @param \Drupal\google_analytics\Event\PagePathEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onPagePath(PagePathEvent $event) {
+ // Get page http status code for visibility filtering.
+ $status = NULL;
+ if ($exception = $this->request->attributes->get('exception')) {
+ $status = $exception->getStatusCode();
+ }
+ // TODO: Make configurable
+ $trackable_status_codes = [
+ // "Forbidden" status code.
+ '403',
+ // "Not Found" status code.
+ '404',
+ ];
+ if (in_array($status, $trackable_status_codes)) {
+ $base_path = base_path();
+
+ // Track access denied (403) and file not found (404) pages.
+ $event->setPagePath('"' . $base_path . $status . '.html?page=" + document.location.pathname + document.location.search + "&from=" + document.referrer');
+ $event->stopPropagation();
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/InvalidUserLogin.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/InvalidUserLogin.php
new file mode 100644
index 000000000..482b3ac2b
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/InvalidUserLogin.php
@@ -0,0 +1,68 @@
+request = $request->getCurrentRequest();
+ $this->currentRoute = $current_route;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::PAGE_PATH][] = ['onPagePath', 100];
+ return $events;
+ }
+
+ /**
+ * Adds error pages to the page path.
+ *
+ * @param \Drupal\google_analytics\Event\PagePathEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onPagePath(PagePathEvent $event) {
+ // #2693595: User has entered an invalid login and clicked on forgot
+ // password link. This link contains the username or email address and may
+ // get send to Google if we do not override it. Override only if 'name'
+ // query param exists. Last custom url condition, this need to win.
+ //
+ // URLs to protect are:
+ // - user/password?name=username
+ // - user/password?name=foo@example.com
+ $base_path = base_path();
+ if ($this->currentRoute->getRouteName() == 'user.pass' && $this->request->query->has('name')) {
+ $event->setPagePath('"' . $base_path . 'user/password"');
+ $event->stopPropagation();
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/Search.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/Search.php
new file mode 100644
index 000000000..a6ce9b419
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/EventSubscriber/PagePath/Search.php
@@ -0,0 +1,92 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->request = $request->getCurrentRequest();
+ $this->moduleHandler = $module_handler;
+ $this->currentRoute = $current_route;
+
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getSubscribedEvents() {
+ $events[GoogleAnalyticsEvents::PAGE_PATH][] = ['onCustomPagePath'];
+ return $events;
+ }
+
+ /**
+ * Adds a new event to the Ga Javascript
+ *
+ * @param \Drupal\google_analytics\Event\PagePathEvent $event
+ * The event being dispatched.
+ *
+ * @throws \Exception
+ */
+ public function onCustomPagePath(PagePathEvent $event) {
+ // Site search tracking support.
+ if ($this->moduleHandler->moduleExists('search') && $this->config->get('track.site_search') && (strpos($this->currentRoute->getRouteName(), 'search.view') === 0) && $keys = ($this->request->query->has('keys') ? trim($this->request->get('keys')) : '')) {
+ // hook_item_list__search_results() is not executed if search result is
+ // empty. Make sure the counter is set to 0 if there are no results.
+ $entity = $this->currentRoute->getParameter('entity');
+ if (isset($entity)) {
+ $entity_id = $entity->id();
+ $url_custom = '(window.google_analytics_search_results) ? ' . Json::encode(Url::fromRoute('search.view_' . $entity_id, [], ['query' => ['search' => $keys]])
+ ->toString()) . ' : ' . Json::encode(Url::fromRoute('search.view_' . $entity_id, [], [
+ 'query' => [
+ 'search' => 'no-results:' . $keys,
+ 'cat' => 'no-results'
+ ]
+ ])->toString());
+ $event->setPagePath($url_custom);
+ $event->stopPropagation();
+ }
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/GaAccount.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/GaAccount.php
new file mode 100644
index 000000000..253bdbd93
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/GaAccount.php
@@ -0,0 +1,45 @@
+account = $account;
+ }
+
+ /**
+ * Return the account as a string.
+ *
+ * @return string
+ */
+ public function __toString() {
+ return $this->account;
+ }
+
+ /**
+ * Detects if there is a universal analytics account.
+ *
+ * If any account is UA, then this will return true.
+ *
+ * @return bool
+ */
+ public function isUniversalAnalyticsAccount() {
+ if (preg_match(GoogleAnalyticsPatterns::GOOGLE_ANALYTICS_UA_MATCH, $this->account)) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+}
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/GaJavascriptInterface.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/GaJavascriptInterface.php
new file mode 100644
index 000000000..5d554a382
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/GaJavascriptInterface.php
@@ -0,0 +1,63 @@
+measurement_id = $measurement_id;
+ $this->setConfig($measurement_id, $config);
+ }
+
+ /**
+ * Static Factory method to allow GaJavascript to interpret their own data.
+ *
+ * @param array $data
+ * Initial data.
+ *
+ * @return \Drupal\google_analytics\GaJavascriptObject
+ * GaJavascriptObject.
+ *
+ */
+ public static function fromArray(array $data) {
+ $object = new static($data['measurement_id'], $data['config']['measurement_id']);
+ return $object;
+ }
+
+ /**
+ * Static Factory method to format data from JSON into the Javascript Object.
+ *
+ * @param string $json
+ * Data in JSON format.
+ *
+ * @return \Drupal\google_analytics\GaJavascriptObject
+ * GA Javascript Object.
+ *
+ * @throws \ReflectionException
+ */
+ public static function fromJson(string $json) {
+ return self::fromArray(json_decode($json, TRUE));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toArray() {
+ $output = [
+ 'measurement_id' => $this->getMeasurementId(),
+ 'config' => $this->config,
+ 'events' => $this->events,
+ ];
+
+ return $output;
+ }
+
+ public function getMeasurementId() {
+ return $this->measurement_id;
+ }
+
+ public function getConfig($measurement_id = NULL) {
+ if (isset($this->config[$measurement_id ?? $this->measurement_id])) {
+ return $this->config[$measurement_id ?? $this->measurement_id];
+ }
+ return [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setConfig($measurement_id, array $config) {
+ $this->config[(string)$measurement_id] = $config;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEvents() {
+ return $this->events;
+ }
+
+ public function addEvent(array $event) {
+ $this->events[] = $event;
+ }
+
+ public function getCustomUrl() {
+ return $this->custom_url;
+ }
+
+ public function setCustomUrl($url) {
+ $this->custom_url = $url;
+ }
+
+ public function setAdsenseScript($domain = 'none') {
+ $this->adsense = 'window.google_analytics_domain_name = ' . Json::encode($domain) . ';
+ window.google_analytics_uacct = ' . Json::encode($this->measurement_id) . ';';
+ }
+
+ public function getAdsenseScript() {
+ return $this->adsense;
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/GoogleAnalyticsAccounts.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/GoogleAnalyticsAccounts.php
new file mode 100644
index 000000000..530dbccf9
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/GoogleAnalyticsAccounts.php
@@ -0,0 +1,112 @@
+config = $config_factory->get('google_analytics.settings');
+
+ $accounts = $this->config->get('account');
+ // Create the accounts array from either a single gtag id or multiple ones.
+ if (strpos($accounts, ',') === FALSE) {
+ $this->accounts[] = new GaAccount($accounts);
+ }
+ else {
+ $accounts_array = explode(',', $accounts);
+ foreach($accounts_array as $account) {
+ $this->accounts[] = new GaAccount($account);
+ }
+ }
+
+ $this->privateKey = $private_key->get();
+ }
+
+ /**
+ * Generate user id hash to implement USER_ID.
+ *
+ * The USER_ID value should be a unique, persistent, and non-personally
+ * identifiable string identifier that represents a user or signed-in
+ * account across devices.
+ *
+ * @param int $uid
+ * User id.
+ *
+ * @return string
+ * User id hash.
+ */
+ public function getUserIdHash($uid) {
+ return Crypt::hmacBase64($uid, $this->privateKey . Settings::getHashSalt());
+ }
+
+ /**
+ * Get the default measurement ID. Defaults to the first account in config.
+ *
+ * @return false|mixed|string
+ */
+ public function getDefaultMeasurementId() {
+ // The top UA- or G- Account is the default measurement ID.
+ foreach ($this->accounts as $account) {
+ if (preg_match(GoogleAnalyticsPatterns::GOOGLE_ANALYTICS_TRACKING_MATCH, $account)) {
+ return $account;
+ }
+ }
+ return FALSE;
+ }
+
+ /**
+ * Get accounts that aren't the default measurement ID.
+ *
+ * @return array|false|string[]
+ */
+ public function getAdditionalAccounts() {
+ return array_filter($this->accounts, function($v) {
+ return $v !== $this->getDefaultMeasurementId();
+ });
+ }
+
+ /**
+ * Return all the GA accounts stored.
+ *
+ * @return array|false|string[]
+ */
+ public function getAccounts() {
+ return $this->accounts;
+ }
+}
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/VisiblityTracker.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/VisiblityTracker.php
new file mode 100644
index 000000000..95f25f6c2
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/Helpers/VisiblityTracker.php
@@ -0,0 +1,172 @@
+config = $config_factory->get('google_analytics.settings');
+ $this->aliasManager = $alias_manager;
+ $this->pathMatcher = $path_matcher;
+ $this->userData = $user_data;
+ $this->currentPath = $current_path;
+ }
+
+
+ /**
+ * Tracking visibility check for an user object.
+ *
+ * @param object $account
+ * A user object containing an array of roles to check.
+ *
+ * @return bool
+ * TRUE if the current user is being tracked by Google Analytics,
+ * otherwise FALSE.
+ */
+ public function getUserVisibilty($account) {
+ $enabled = FALSE;
+
+ // Is current user a member of a role that should be tracked?
+ if ($this->getVisibilityRoles($account)) {
+
+ // Use the user's block visibility setting, if necessary.
+ if (($visibility_user_account_mode = $this->config->get('visibility.user_account_mode')) != 0) {
+ $user_data_google_analytics = $this->userData->get('google_analytics', $account->id());
+ if ($account->id() && isset($user_data_google_analytics['user_account_users'])) {
+ $enabled = $user_data_google_analytics['user_account_users'];
+ }
+ else {
+ $enabled = ($visibility_user_account_mode == 1);
+ }
+ }
+ else {
+ $enabled = TRUE;
+ }
+ }
+
+ return $enabled;
+ }
+
+ /**
+ * Tracking visibility check for user roles.
+ *
+ * Based on visibility setting this function returns TRUE if JS code should
+ * be added for the current role and otherwise FALSE.
+ *
+ * @param object $account
+ * A user object containing an array of roles to check.
+ *
+ * @return bool
+ * TRUE if JS code should be added for the current role and otherwise FALSE.
+ */
+ public function getVisibilityRoles($account) {
+ $enabled = $visibility_user_role_mode = $this->config->get('visibility.user_role_mode');
+ $visibility_user_role_roles = $this->config->get('visibility.user_role_roles');
+
+ if (count($visibility_user_role_roles) > 0) {
+ // One or more roles are selected.
+ foreach (array_values($account->getRoles()) as $user_role) {
+ // Is the current user a member of one of these roles?
+ if (in_array($user_role, $visibility_user_role_roles)) {
+ // Current user is a member of a role that should be tracked/excluded
+ // from tracking.
+ $enabled = !$visibility_user_role_mode;
+ break;
+ }
+ }
+ }
+ else {
+ // No role is selected for tracking, therefore all roles should be tracked.
+ $enabled = TRUE;
+ }
+
+ return $enabled;
+ }
+
+ /**
+ * Tracking visibility check for pages.
+ *
+ * Based on visibility setting this function returns TRUE if JS code should
+ * be added to the current page and otherwise FALSE.
+ */
+ public function getVisibilityPages() {
+ static $page_match;
+
+ // Cache visibility result if function is called more than once.
+ if (!isset($page_match)) {
+ $visibility_request_path_mode = $this->config->get('visibility.request_path_mode');
+ $visibility_request_path_pages = $this->config->get('visibility.request_path_pages');
+
+ // Match path if necessary.
+ if (!empty($visibility_request_path_pages)) {
+ // Convert path to lowercase. This allows comparison of the same path
+ // with different case. Ex: /Page, /page, /PAGE.
+ $pages = mb_strtolower($visibility_request_path_pages);
+ if ($visibility_request_path_mode < 2) {
+ // Compare the lowercase path alias (if any) and internal path.
+ $path = $this->currentPath->getPath();
+ $path_alias = mb_strtolower($this->aliasManager->getAliasByPath($path));
+ $page_match = $this->pathMatcher->matchPath($path_alias, $pages) || (($path != $path_alias) && $this->pathMatcher->matchPath($path, $pages));
+ // When $visibility_request_path_mode has a value of 0, the tracking
+ // code is displayed on all pages except those listed in $pages. When
+ // set to 1, it is displayed only on those pages listed in $pages.
+ $page_match = !($visibility_request_path_mode xor $page_match);
+ }
+ else {
+ $page_match = FALSE;
+ }
+ }
+ else {
+ $page_match = TRUE;
+ }
+
+ }
+ return $page_match;
+ }
+}
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/src/JavascriptLocalCache.php b/frontend/drupal9/web/modules/contrib/google_analytics/src/JavascriptLocalCache.php
new file mode 100644
index 000000000..0d72efea4
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/src/JavascriptLocalCache.php
@@ -0,0 +1,138 @@
+httpClient = $http_client;
+ $this->fileSystem = $file_system;
+ $this->configFactory = $config_factory;
+ $this->state = $state;
+ $this->logger = $logger_factory->get('google_analytics');
+ }
+ /**
+ * Download/Synchronize/Cache tracking code file locally.
+ *
+ * @param string $tracking_id
+ * The GA Tracking ID
+ * @param bool $synchronize
+ * Synchronize to local cache if remote file has changed.
+ *
+ * @return string
+ * The path to the local or remote tracking file.
+ */
+ public function fetchGoogleAnalyticsJavascript(string $tracking_id, bool $synchronize = FALSE) {
+ $path = 'public://google_analytics';
+ $remote_url = self::GOOGLE_ANALYTICS_JAVASCRIPT_URL . '?id=' . $tracking_id;
+ $file_destination = $path . '/gtag.js';
+
+ // If cache is disabled, just return the URL for GA
+ if (!$this->configFactory->get('google_analytics.settings')->get('cache')) {
+ return $remote_url;
+ }
+
+ if (!file_exists($file_destination) || $synchronize) {
+ // Download the latest tracking code.
+ try {
+ $data = (string) $this->httpClient
+ ->get($remote_url)
+ ->getBody();
+
+ if (file_exists($file_destination)) {
+ // Synchronize tracking code and replace local file if outdated.
+ $data_hash_local = Crypt::hashBase64(file_get_contents($file_destination));
+ $data_hash_remote = Crypt::hashBase64($data);
+ // Check that the files directory is writable.
+ if ($data_hash_local != $data_hash_remote && $this->fileSystem->prepareDirectory($path)) {
+ // Save updated tracking code file to disk.
+ $this->fileSystem->saveData($data, $file_destination, FileSystemInterface::EXISTS_REPLACE);
+ // Based on Drupal Core class AssetDumper.
+ if (extension_loaded('zlib') && $this->configFactory->get('system.performance')->get('js.gzip')) {
+ $this->fileSystem->saveData(gzencode($data, 9, FORCE_GZIP), $file_destination . '.gz', FileSystemInterface::EXISTS_REPLACE);
+ }
+ $this->logger->info('Locally cached tracking code file has been updated.');
+
+ // Change query-strings on css/js files to enforce reload for all
+ // users.
+ _drupal_flush_css_js();
+ }
+ }
+ else {
+ // Check that the files directory is writable.
+ if ($this->fileSystem->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY)) {
+ // There is no need to flush JS here as core refreshes JS caches
+ // automatically, if new files are added.
+ $this->fileSystem->saveData($data, $file_destination, FileSystemInterface::EXISTS_REPLACE);
+ // Based on Drupal Core class AssetDumper.
+ if (extension_loaded('zlib') && $this->configFactory->get('system.performance')->get('js.gzip')) {
+ $this->fileSystem->saveData(gzencode($data, 9, FORCE_GZIP), $file_destination . '.gz', FileSystemInterface::EXISTS_REPLACE);
+ }
+ $this->logger->info('Locally cached tracking code file has been saved.');
+ }
+ }
+ }
+ catch (RequestException $exception) {
+ watchdog_exception('google_analytics', $exception);
+ return $remote_url;
+ }
+ }
+ // Return the local JS file path.
+ $query_string = '?' . (\Drupal::state()->get('system.css_js_query_string') ?: '0');
+ return file_url_transform_relative(file_create_url($file_destination)) . $query_string;
+ }
+
+ /**
+ * Delete cached files and directory.
+ */
+ public function clearGoogleAnalyticsJsCache() {
+ $path = 'public://google_analytics';
+ if (is_dir($path)) {
+ $this->fileSystem->deleteRecursive($path);
+
+ // Change query-strings on css/js files to enforce reload for all users.
+ _drupal_flush_css_js();
+
+ $this->logger->info('Local Google Analytics file cache has been purged.');
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php b/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php
new file mode 100644
index 000000000..5765257ba
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/FunctionalJavascript/GoogleAnalyticsFormValidationTest.php
@@ -0,0 +1,147 @@
+drupalCreateContentType([
+ 'type' => 'article',
+ 'name' => 'Article',
+ ]);
+
+ // User to set up google_analytics.
+ $this->adminUser = $this->drupalCreateUser($permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Tests if Custom Dimensions token form validation works.
+ */
+ public function testGoogleAnalyticsCustomDimensionsTokenFormValidation() {
+ $this->drupalGet('admin/config/services/google-analytics');
+ $assert_session = $this->assertSession();
+ $page = $this->getSession()->getPage();
+
+ // Set the UA Code
+ $user_name = $assert_session->waitForField('accounts[0][value]');
+ $account_field = $page->findField('accounts[0][value]');
+ $account_field->setValue('UA-123456-1');
+
+ $dms = $assert_session->waitForLink('Dimensions and Metrics');
+ $page->clickLink('Dimensions and Metrics');
+
+ // First set a value on the first input field.
+ $field_0_name = $page->findField('custom_parameters[0][name]');
+ $field_0_name->setValue('current_user_name');
+ $field_0_value = $page->findField('custom_parameters[0][value]');
+ $field_0_value->setValue('[current-user:name]');
+
+ // Validate the value of the first field exists.
+ $this->assertEquals('current_user_name', $field_0_name->getValue(), 'Name for the first item has not changed.');
+ $this->assertEquals('[current-user:name]', $field_0_value->getValue(), 'Value for the first item has not changed.');
+
+ /** TODO: Fix tests in Issue #3243622
+ $add_more_button = $page->findButton('Add another Parameter');
+ // Add another item
+ $add_more_button->click();
+ $field_1 = $assert_session->waitForField('custom_parameters[1][name]');
+ $this->assertNotEmpty($field_1, 'Successfully added another item.');
+
+ // Validate the value of the first field has not changed.
+ $this->assertEquals('current_user_name', $field_0_name->getValue(), 'Name for the first item has not changed.');
+ $this->assertEquals('[current-user:name]', $field_0_value->getValue(), 'Value for the first item has not changed.');
+
+ // Validate the value of the second item is empty.
+ $this->assertEmpty($field_1->getValue(), 'Value for the second item is currently empty.');
+
+ $field_1_name = $page->findField('custom_parameters[1][name]');
+ $field_1_name->setValue('current_user_edit_url');
+ $field_1_value = $page->findField('custom_parameters[1][value]');
+ $field_1_value->setValue('[current-user:edit-url]');
+
+ // Add third item
+ $add_more_button->click();
+ $field_2 = $assert_session->waitForField('custom_parameters[2][name]');
+ $this->assertNotEmpty($field_2, 'Successfully added another item.');
+
+ $field_2_name = $page->findField('custom_parameters[2][name]');
+ $field_2_name->setValue('user_name');
+ $field_2_value = $page->findField('custom_parameters[2][value]');
+ $field_2_value->setValue('[user:name]');
+
+ // Add forth item
+ $add_more_button->click();
+ $field_3 = $assert_session->waitForField('custom_parameters[3][name]');
+ $this->assertNotEmpty($field_3, 'Successfully added another item.');
+
+ $field_3_name = $page->findField('custom_parameters[3][name]');
+ $field_3_name->setValue('term_name');
+ $field_3_value = $page->findField('custom_parameters[3][value]');
+ $field_3_value->setValue('[term:name]');
+
+ // Add fifth item
+ $add_more_button->click();
+ $field_4 = $assert_session->waitForField('custom_parameters[4][name]');
+ $this->assertNotEmpty($field_4, 'Successfully added another item.');
+
+ $field_4_name = $page->findField('custom_parameters[4][name]');
+ $field_4_name->setValue('term_tid');
+ $field_4_value = $page->findField('custom_parameters[4][value]');
+ $field_4_value->setValue('[term:tid]');
+
+ $page->pressButton('op');
+
+ // Check form validation.
+ $this->assertSession()->responseContains($this->t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', ['%element-title' => $this->t('Custom dimension value #@index', ['@index' => 0]), '@invalid-tokens' => implode(', ', ['[current-user:name]'])]));
+ $this->assertSession()->responseContains($this->t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', ['%element-title' => $this->t('Custom dimension value #@index', ['@index' => 1]), '@invalid-tokens' => implode(', ', ['[current-user:edit-url]'])]));
+ $this->assertSession()->responseContains($this->t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', ['%element-title' => $this->t('Custom dimension value #@index', ['@index' => 2]), '@invalid-tokens' => implode(', ', ['[user:name]'])]));
+ // BUG #2037595
+ //$this->assertSession()->responseNotContains($this->t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', ['%element-title' => t('Custom dimension value #@index', ['@index' => 4]), '@invalid-tokens' => implode(', ', ['[term:name]'])]));
+ //$this->assertSession()->responseNotContains($this->t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', ['%element-title' => t('Custom dimension value #@index', ['@index' => 5]), '@invalid-tokens' => implode(', ', ['[term:tid]'])]));
+ */
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php b/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php
new file mode 100644
index 000000000..57a835d95
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_analytics/tests/src/Kernel/Form/GoogleAnalyticsAdminSettingsFormTest.php
@@ -0,0 +1,68 @@
+installConfig(static::$modules);
+ $this->googleAnalyticsSettingsForm = new GoogleAnalyticsAdminSettingsForm(
+ $this->container->get('config.factory'),
+ $this->container->get('current_user'),
+ $this->container->get('module_handler'),
+ $this->container->get('google_analytics.accounts'),
+ $this->container->get('google_analytics.javascript_cache')
+ );
+ }
+
+ /**
+ * Tests for \Drupal\google_analytics\Form\GoogleAnalyticsAdminSettingsForm.
+ */
+ public function testGoogleAnalyticsAdminSettingsForm() {
+ $this->assertInstanceOf(FormInterface::class, $this->googleAnalyticsSettingsForm);
+
+ $this->assertEquals('google_analytics_admin_settings', $this->googleAnalyticsSettingsForm->getFormId());
+
+ $method = new \ReflectionMethod(GoogleAnalyticsAdminSettingsForm::class, 'getEditableConfigNames');
+ $method->setAccessible(TRUE);
+
+ $name = $method->invoke($this->googleAnalyticsSettingsForm);
+ $this->assertEquals(['google_analytics.settings'], $name);
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/.tugboat/config.yml b/frontend/drupal9/web/modules/contrib/google_cse/.tugboat/config.yml
new file mode 100644
index 000000000..56f0e46ad
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_cse/.tugboat/config.yml
@@ -0,0 +1,51 @@
+services:
+ php:
+ image: q0rban/tugboat-drupal:9.3
+ default: true
+ http: false
+ depends: mysql
+ commands:
+ update: |
+ set -eux
+ # Check out a branch using the unique Tugboat ID for this repository, to
+ # ensure we don't clobber an existing branch.
+ git checkout -b $TUGBOAT_REPO_ID
+ # Composer is hungry. You need a Tugboat project with a pretty sizeable
+ # chunk of memory.
+ export COMPOSER_MEMORY_LIMIT=-1
+ # This is an environment variable we added in the Dockerfile that
+ # provides the path to Drupal composer root (not the web root).
+ cd $DRUPAL_COMPOSER_ROOT
+ # We configure the Drupal project to use the checkout of the module as a
+ # Composer package repository.
+ composer config repositories.tugboat vcs $TUGBOAT_ROOT
+ # Now we can require this module, specifing the branch name we created
+ # above that uses the $TUGBOAT_REPO_ID environment variable.
+ composer require drupal/google_cse:dev-$TUGBOAT_REPO_ID
+ # Install Drupal on the site.
+ vendor/bin/drush \
+ --yes \
+ --db-url=mysql://tugboat:tugboat@mysql:3306/tugboat \
+ --site-name="Live preview for ${TUGBOAT_PREVIEW_NAME}" \
+ --account-pass=admin \
+ site:install standard
+ # Set up the files directory permissions.
+ mkdir -p $DRUPAL_DOCROOT/sites/default/files
+ chgrp -R www-data $DRUPAL_DOCROOT/sites/default/files
+ chmod 2775 $DRUPAL_DOCROOT/sites/default/files
+ chmod -R g+w $DRUPAL_DOCROOT/sites/default/files
+ # Enable the module.
+ vendor/bin/drush --yes pm:enable google_cse
+ build: |
+ set -eux
+ # Delete and re-check out this branch in case this is built from a Base Preview.
+ git branch -D $TUGBOAT_REPO_ID && git checkout -b $TUGBOAT_REPO_ID || true
+ export COMPOSER_MEMORY_LIMIT=-1
+ cd $DRUPAL_COMPOSER_ROOT
+ composer install --optimize-autoloader
+ # Update this module, including all dependencies.
+ composer update drupal/google_cse --with-all-dependencies
+ vendor/bin/drush --yes updb
+ vendor/bin/drush cache:rebuild
+ mysql:
+ image: tugboatqa/mariadb
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/composer.json b/frontend/drupal9/web/modules/contrib/google_cse/composer.json
new file mode 100644
index 000000000..27a26e833
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_cse/composer.json
@@ -0,0 +1,22 @@
+{
+ "name": "drupal/google_cse",
+ "description": "Use Google Custom Search to search your site and/or any other sites.",
+ "type": "drupal-module",
+ "license": "GPL-2.0-or-later",
+ "minimum-stability": "dev",
+ "homepage": "https://drupal.org/project/google_cse",
+ "support": {
+ "issues": "https://www.drupal.org/project/issues/google_cse?version=8.x",
+ "source": "https://git.drupalcode.org/project/google_cse"
+ },
+ "require": {
+ "drupal/core": "^8 || ^9 || ^10"
+ },
+ "extra": {
+ "drush": {
+ "services": {
+ "drush.services.yml": "^9 || ^10"
+ }
+ }
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/google_cse.info.yml b/frontend/drupal9/web/modules/contrib/google_cse/google_cse.info.yml
index 886fe1b16..2e1263cd2 100644
--- a/frontend/drupal9/web/modules/contrib/google_cse/google_cse.info.yml
+++ b/frontend/drupal9/web/modules/contrib/google_cse/google_cse.info.yml
@@ -6,7 +6,7 @@ core_version_requirement: ^8 || ^9 || ^10
dependencies:
- drupal:search
-# Information added by Drupal.org packaging script on 2022-01-28
-version: '8.x-3.5'
+# Information added by Drupal.org packaging script on 2022-05-09
+version: '8.x-3.7'
project: 'google_cse'
-datestamp: 1643395129
+datestamp: 1652112189
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/google_cse.module b/frontend/drupal9/web/modules/contrib/google_cse/google_cse.module
index caab1e30d..ab3d57768 100644
--- a/frontend/drupal9/web/modules/contrib/google_cse/google_cse.module
+++ b/frontend/drupal9/web/modules/contrib/google_cse/google_cse.module
@@ -8,6 +8,8 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\search\Entity\SearchPage;
+use Drupal\migrate\Exception\RequirementsException;
+use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
/**
* Implements hook_help().
@@ -151,3 +153,45 @@ function google_cse_entity_insert(EntityInterface $entity) {
}
}
}
+
+/**
+ * Implements hook_migration_plugins_alter().
+ */
+function google_cse_migration_plugins_alter(array &$migrations) {
+ if (!in_array('d7_search_settings', array_keys($migrations))) {
+ return;
+ }
+ $variable_source = \Drupal::service('plugin.manager.migration')
+ ->createStubMigration([
+ 'id' => 'foo',
+ 'idMap' => ['plugin' => 'null'],
+ 'source' => [
+ 'plugin' => 'variable',
+ 'ignore_map' => TRUE,
+ ],
+ 'destination' => ['plugin' => 'null'],
+ ])
+ ->getSourcePlugin();
+ if (!$variable_source instanceof DrupalSqlBase) {
+ return;
+ }
+ try {
+ $variable_source->checkRequirements();
+ }
+ catch (RequirementsException $e) {
+ // Variable source plugin requirements aren't met, this is not a Drupal
+ // source.
+ return;
+ }
+ $system_data = $variable_source->getSystemData();
+ if (empty($system_data['module']['google_cse']['status'])) {
+ unset($migrations['d7_google_cse']);
+ return;
+ }
+ if (
+ !empty($migrations['d7_search_settings']['process']['default_page']) &&
+ array_key_exists('map', $migrations['d7_search_settings']['process']['default_page'])
+ ) {
+ $migrations['d7_search_settings']['process']['default_page']['map']['google_cse'] = 'google_cse_search';
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/migrations/d7_google_cse.yml b/frontend/drupal9/web/modules/contrib/google_cse/migrations/d7_google_cse.yml
new file mode 100644
index 000000000..e849fb913
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_cse/migrations/d7_google_cse.yml
@@ -0,0 +1,111 @@
+id: d7_google_cse
+label: Google CSE configuration
+migration_tags:
+ - Drupal 7
+ - Configuration
+source:
+ plugin: variable
+ variables:
+ - google_cse_results_prefix
+ - google_cse_results_suffix
+ - google_cse_cx
+ - google_cse_results_tab
+ - google_cse_results_width
+ - google_cse_results_searchbox_width
+ - search_active_modules
+ - google_cse_cof_google
+ - google_cse_cof_here
+ - google_cse_custom_results_display
+ - google_cse_results_display
+ - google_cse_results_display_images
+ - google_cse_custom_css
+ constants:
+ google_cse_search: google_cse_search
+ google_cse: google_cse
+ status: true
+ label: Google CSE Search
+process:
+ module: 'constants/google_cse'
+ module_exists: 'constants/status'
+ search_active_modules:
+ -
+ plugin: default_value
+ source: search_active_modules
+ strict: true
+ default_value:
+ - node
+ - user
+ -
+ plugin: flatten
+ status:
+ plugin: callback
+ callable: 'in_array'
+ unpack_source: true
+ source:
+ - 'constants/google_cse'
+ - '@search_active_modules'
+ id: 'constants/google_cse_search'
+ plugin: 'constants/google_cse_search'
+ label: 'constants/label'
+ 'configuration/results_prefix':
+ plugin: default_value
+ source: 'google_cse_results_prefix'
+ strict: true
+ default_value: ''
+ 'configuration/results_suffix':
+ plugin: default_value
+ source: 'google_cse_results_suffix'
+ strict: true
+ default_value: ''
+ 'configuration/cx':
+ plugin: default_value
+ source: 'google_cse_cx'
+ strict: true
+ default_value: ''
+ 'configuration/results_tab':
+ plugin: default_value
+ source: 'google_cse_results_tab'
+ strict: true
+ default_value: ''
+ 'configuration/results_width':
+ plugin: default_value
+ source: 'google_cse_results_width'
+ strict: true
+ default_value: 600
+ 'configuration/results_searchbox_width':
+ plugin: default_value
+ source: 'google_cse_results_searchbox_width'
+ strict: true
+ default_value: 40
+ 'configuration/cof_here':
+ plugin: default_value
+ source: 'google_cse_cof_here'
+ strict: true
+ default_value: 'FORID:11'
+ 'configuration/cof_google':
+ plugin: default_value
+ source: 'google_cse_cof_google'
+ strict: true
+ default_value: 'FORID:0'
+ 'configuration/custom_results_display':
+ plugin: default_value
+ source: 'google_cse_custom_results_display'
+ strict: true
+ default_value: 'results-only'
+ 'configuration/results_display':
+ plugin: default_value
+ source: 'google_cse_results_display'
+ strict: true
+ default_value: 'here'
+ 'configuration/results_display_images':
+ plugin: default_value
+ source: 'google_cse_results_display_images'
+ strict: true
+ default_value: true
+ 'configuration/custom_css':
+ plugin: default_value
+ source: 'google_cse_custom_css'
+ strict: true
+ default_value: ''
+destination:
+ plugin: entity:search_page
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/tests/fixtures/drupal7.php b/frontend/drupal9/web/modules/contrib/google_cse/tests/fixtures/drupal7.php
new file mode 100644
index 000000000..58e322878
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_cse/tests/fixtures/drupal7.php
@@ -0,0 +1,217 @@
+schema()->createTable('system', array(
+ 'fields' => array(
+ 'filename' => array(
+ 'type' => 'varchar',
+ 'not null' => TRUE,
+ 'length' => '255',
+ 'default' => '',
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'not null' => TRUE,
+ 'length' => '255',
+ 'default' => '',
+ ),
+ 'type' => array(
+ 'type' => 'varchar',
+ 'not null' => TRUE,
+ 'length' => '12',
+ 'default' => '',
+ ),
+ 'owner' => array(
+ 'type' => 'varchar',
+ 'not null' => TRUE,
+ 'length' => '255',
+ 'default' => '',
+ ),
+ 'status' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'size' => 'normal',
+ 'default' => '0',
+ ),
+ 'bootstrap' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'size' => 'normal',
+ 'default' => '0',
+ ),
+ 'schema_version' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'size' => 'small',
+ 'default' => '-1',
+ ),
+ 'weight' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'size' => 'normal',
+ 'default' => '0',
+ ),
+ 'info' => array(
+ 'type' => 'blob',
+ 'not null' => FALSE,
+ 'size' => 'normal',
+ ),
+ ),
+ 'primary key' => array(
+ 'filename',
+ ),
+ 'indexes' => array(
+ 'system_list' => array(
+ 'status',
+ 'bootstrap',
+ 'type',
+ 'weight',
+ 'name',
+ ),
+ 'type_name' => array(
+ 'type',
+ 'name',
+ ),
+ ),
+ 'mysql_character_set' => 'utf8mb3',
+));
+
+$connection->insert('system')
+->fields(array(
+ 'filename',
+ 'name',
+ 'type',
+ 'owner',
+ 'status',
+ 'bootstrap',
+ 'schema_version',
+ 'weight',
+ 'info',
+))
+->values(array(
+ 'filename' => 'modules/search/search.module',
+ 'name' => 'search',
+ 'type' => 'module',
+ 'owner' => '',
+ 'status' => '1',
+ 'bootstrap' => '0',
+ 'schema_version' => '7000',
+ 'weight' => '0',
+ 'info' => 'a:14:{s:4:"name";s:6:"Search";s:11:"description";s:36:"Enables site-wide keyword searching.";s:7:"package";s:4:"Core";s:7:"version";s:4:"7.84";s:4:"core";s:3:"7.x";s:5:"files";a:2:{i:0;s:19:"search.extender.inc";i:1;s:11:"search.test";}s:9:"configure";s:28:"admin/config/search/settings";s:11:"stylesheets";a:1:{s:3:"all";a:1:{s:10:"search.css";s:25:"modules/search/search.css";}}s:7:"project";s:6:"drupal";s:9:"datestamp";s:10:"1639410569";s:5:"mtime";i:1639410569;s:12:"dependencies";a:0:{}s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}',
+))
+->values(array(
+ 'filename' => 'sites/all/modules/contrib/google_cse/google_cse.module',
+ 'name' => 'google_cse',
+ 'type' => 'module',
+ 'owner' => '',
+ 'status' => '1',
+ 'bootstrap' => '0',
+ 'schema_version' => '7201',
+ 'weight' => '0',
+ 'info' => 'a:14:{s:4:"name";s:10:"Google CSE";s:11:"description";s:68:"Use Google Custom Search to search your site and/or any other sites.";s:4:"core";s:3:"7.x";s:12:"dependencies";a:1:{i:0;s:6:"search";}s:5:"files";a:5:{i:0;s:18:"google_cse.install";i:1;s:17:"google_cse.module";i:2;s:20:"google_cse.admin.inc";i:3;s:20:"google_cse.theme.inc";i:4;s:21:"tests/google_cse.test";}s:7:"scripts";a:1:{s:13:"google_cse.js";s:50:"sites/all/modules/contrib/google_cse/google_cse.js";}s:11:"stylesheets";a:1:{s:3:"all";a:1:{s:14:"google_cse.css";s:51:"sites/all/modules/contrib/google_cse/google_cse.css";}}s:7:"version";s:14:"7.x-3.0-alpha1";s:7:"project";s:10:"google_cse";s:9:"datestamp";s:10:"1493228052";s:5:"mtime";i:1493228052;s:7:"package";s:5:"Other";s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}',
+))
+->values(array(
+ 'filename' => 'modules/system/system.module',
+ 'name' => 'system',
+ 'type' => 'module',
+ 'owner' => '',
+ 'status' => '1',
+ 'bootstrap' => '0',
+ 'schema_version' => '7084',
+ 'weight' => '0',
+ 'info' => 'a:14:{s:4:"name";s:6:"System";s:11:"description";s:54:"Handles general site configuration for administrators.";s:7:"package";s:4:"Core";s:7:"version";s:4:"7.84";s:4:"core";s:3:"7.x";s:5:"files";a:6:{i:0;s:19:"system.archiver.inc";i:1;s:15:"system.mail.inc";i:2;s:16:"system.queue.inc";i:3;s:14:"system.tar.inc";i:4;s:18:"system.updater.inc";i:5;s:11:"system.test";}s:8:"required";b:1;s:9:"configure";s:19:"admin/config/system";s:7:"project";s:6:"drupal";s:9:"datestamp";s:10:"1639410569";s:5:"mtime";i:1639410569;s:12:"dependencies";a:0:{}s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;}',
+))
+->execute();
+
+$connection->schema()->createTable('variable', array(
+ 'fields' => array(
+ 'name' => array(
+ 'type' => 'varchar',
+ 'not null' => TRUE,
+ 'length' => '128',
+ 'default' => '',
+ ),
+ 'value' => array(
+ 'type' => 'blob',
+ 'not null' => TRUE,
+ 'size' => 'big',
+ ),
+ ),
+ 'primary key' => array(
+ 'name',
+ ),
+ 'mysql_character_set' => 'utf8mb3',
+));
+
+$connection->insert('variable')
+->fields(array(
+ 'name',
+ 'value',
+))
+->values(array(
+ 'name' => 'google_cse_cof_google',
+ 'value' => 's:7:"FORID:1";',
+))
+->values(array(
+ 'name' => 'google_cse_cof_here',
+ 'value' => 's:8:"FORID:10";',
+))
+->values(array(
+ 'name' => 'google_cse_custom_css',
+ 'value' => 's:15:"some stylesheet";',
+))
+->values(array(
+ 'name' => 'google_cse_custom_results_display',
+ 'value' => 's:10:"two-column";',
+))
+->values(array(
+ 'name' => 'google_cse_cx',
+ 'value' => 's:15:"abcgooglecustom";',
+))
+->values(array(
+ 'name' => 'google_cse_results_display',
+ 'value' => 's:4:"here";',
+))
+->values(array(
+ 'name' => 'google_cse_results_display_images',
+ 'value' => 'i:1;',
+))
+->values(array(
+ 'name' => 'google_cse_results_prefix',
+ 'value' => 's:11:"some prefix";',
+))
+->values(array(
+ 'name' => 'google_cse_results_searchbox_width',
+ 'value' => 's:2:"47";',
+))
+->values(array(
+ 'name' => 'google_cse_results_suffix',
+ 'value' => 's:11:"some suffix";',
+))
+->values(array(
+ 'name' => 'google_cse_results_tab',
+ 'value' => 's:14:"somecustomname";',
+))
+->values(array(
+ 'name' => 'google_cse_results_width',
+ 'value' => 's:3:"608";',
+))
+->values(array(
+ 'name' => 'search_active_modules',
+ 'value' => 'a:3:{s:10:"google_cse";s:10:"google_cse";s:4:"node";s:4:"node";s:4:"user";s:4:"user";}',
+))
+->values(array(
+ 'name' => 'search_default_module',
+ 'value' => 's:10:"google_cse";',
+))
+->execute();
diff --git a/frontend/drupal9/web/modules/contrib/google_cse/tests/src/Kernel/GoogleCseMigrationTest.php b/frontend/drupal9/web/modules/contrib/google_cse/tests/src/Kernel/GoogleCseMigrationTest.php
new file mode 100644
index 000000000..206be36bf
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/google_cse/tests/src/Kernel/GoogleCseMigrationTest.php
@@ -0,0 +1,81 @@
+getPath('google_cse'),
+ 'tests',
+ 'fixtures',
+ 'drupal7.php',
+ ]);
+ }
+
+ /**
+ * Asserts that Google CSE configuration is migrated.
+ */
+ public function testGoogleCseMigration() {
+ $this->executeMigration('d7_google_cse');
+ $this->assertEquals(
+ [
+ 'langcode' => 'en',
+ 'status' => TRUE,
+ 'dependencies' => [
+ 'module' => [
+ 0 => 'google_cse',
+ ],
+ ],
+ 'id' => 'google_cse_search',
+ 'label' => 'Google CSE Search',
+ 'path' => NULL,
+ 'weight' => 0,
+ 'plugin' => 'google_cse_search',
+ 'configuration' => [
+ 'results_prefix' => 'some prefix',
+ 'results_suffix' => 'some suffix',
+ 'cx' => 'abcgooglecustom',
+ 'results_tab' => 'somecustomname',
+ 'results_width' => '608',
+ 'results_searchbox_width' => '47',
+ 'cof_here' => 'FORID:10',
+ 'cof_google' => 'FORID:1',
+ 'custom_results_display' => 'two-column',
+ 'results_display' => 'here',
+ 'results_display_images' => 1,
+ 'custom_css' => 'some stylesheet',
+ ],
+ ],
+ array_diff_key($this->config('search.page.google_cse_search')
+ ->getRawData(), ['uuid' => 'uuid']));
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/LICENSE.txt b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/LICENSE.txt
new file mode 100644
index 000000000..d159169d1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/README.md b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/README.md
new file mode 100644
index 000000000..0954ee562
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/README.md
@@ -0,0 +1,40 @@
+# jQuery UI Effects
+
+Drupal 8 includes jQuery UI in core, however it is no longer actively
+maintained and has been marked deprecated. This module provides the
+jQuery UI Effects library for any themes and modules that require it.
+
+ - jQuery UI [Effects documentation](https://jqueryui.com/effect/)
+ - jQuery UI [Effects API documentation](https://api.jqueryui.com/effect/)
+
+**Caution**: jQuery UI was deprecated from core because it is no longer
+actively maintained, and has been marked “End of Life” by the OpenJS
+Foundation. It is not recommended to depend on jQuery UI in your own
+code, and instead to select a replacement solution as soon as possible.
+
+## Instructions
+
+1. Install this module and the jQuery UI module.
+2. Change any references in your theme or module from
+ `core/jquery.ui.effects.{{ effect_name }}` to `jquery_ui_effects/{{
+ effect_name }}`
+
+### Requirements
+
+ - [jQuery UI](https://www.drupal.org/project/jquery_ui)
+
+### Related modules
+
+ - [jQuery UI Accordion](https://www.drupal.org/project/jquery_ui_accordion)
+ - [jQuery UI Button](https://www.drupal.org/project/jquery_ui_button)
+ - [jQuery UI Checkboxradio](https://www.drupal.org/project/jquery_ui_checkboxradio)
+ - [jQuery UI Controlgroup](https://www.drupal.org/project/jquery_ui_controlgroup)
+ - [jQuery UI Draggable](https://www.drupal.org/project/jquery_ui_draggable)
+ - [jQuery UI Droppable](https://www.drupal.org/project/jquery_ui_droppable)
+ - [jQuery UI Menu](https://www.drupal.org/project/jquery_ui_menu)
+ - [jQuery UI Progressbar](https://www.drupal.org/project/jquery_ui_progressbar)
+ - [jQuery UI Selectable](https://www.drupal.org/project/jquery_ui_selectable)
+ - [jQuery UI Selectmenu](https://www.drupal.org/project/jquery_ui_selectmenu)
+ - [jQuery UI Slider](https://www.drupal.org/project/jquery_ui_slider)
+ - [jQuery UI Spinner](https://www.drupal.org/project/jquery_ui_spinner)
+ - [jQuery UI Tooltip](https://www.drupal.org/project/jquery_ui_tooltip)
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effect-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effect-min.js
new file mode 100644
index 000000000..ec305c8ee
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effect-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","./version"],a):a(jQuery)}(function(a){var b="ui-effects-",c="ui-effects-style",d="ui-effects-animated",e=a;return a.effects={effect:{}},function(a,b){function c(a,b,c){var d=l[b.type]||{};return null==a?c||!b.def?null:b.def:(a=d.floor?~~a:parseFloat(a),isNaN(a)?b.def:d.mod?(a+d.mod)%d.mod:0>a?0:d.max")[0],o=a.each;n.style.cssText="background-color:rgba(1,1,1,.5)",m.rgba=n.style.backgroundColor.indexOf("rgba")>-1,o(k,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),j.fn=a.extend(j.prototype,{parse:function(e,g,h,i){if(e===b)return this._rgba=[null,null,null,null],this;(e.jquery||e.nodeType)&&(e=a(e).css(g),g=b);var l=this,m=a.type(e),n=this._rgba=[];return g!==b&&(e=[e,g,h,i],m="array"),"string"===m?this.parse(d(e)||f._default):"array"===m?(o(k.rgba.props,function(a,b){n[b.idx]=c(e[b.idx],b)}),this):"object"===m?(e instanceof j?o(k,function(a,b){e[b.cache]&&(l[b.cache]=e[b.cache].slice())}):o(k,function(b,d){var f=d.cache;o(d.props,function(a,b){if(!l[f]&&d.to){if("alpha"===a||null==e[a])return;l[f]=d.to(l._rgba)}l[f][b.idx]=c(e[a],b,!0)}),l[f]&&a.inArray(null,l[f].slice(0,3))<0&&(l[f][3]=1,d.from&&(l._rgba=d.from(l[f])))}),this):void 0},is:function(a){var b=j(a),c=!0,d=this;return o(k,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],o(e.props,function(a,b){if(null!=g[b.idx])return c=g[b.idx]===f[b.idx]})),c}),c},_space:function(){var a=[],b=this;return o(k,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var d=j(a),e=d._space(),f=k[e],g=0===this.alpha()?j("transparent"):this,h=g[f.cache]||f.to(g._rgba),i=h.slice();return d=d[f.cache],o(f.props,function(a,e){var f=e.idx,g=h[f],j=d[f],k=l[e.type]||{};null!==j&&(null===g?i[f]=j:(k.mod&&(j-g>k.mod/2?g+=k.mod:g-j>k.mod/2&&(g-=k.mod)),i[f]=c((j-g)*b+g,e)))}),this[e](i)},blend:function(b){if(1===this._rgba[3])return this;var c=this._rgba.slice(),d=c.pop(),e=j(b)._rgba;return j(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return null==a?b>2?1:0:a});return 1===c[3]&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return null==a&&(a=b>2?1:0),b&&b<3&&(a=Math.round(100*a)+"%"),a});return 1===c[3]&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(255*d)),"#"+a.map(c,function(a){return a=(a||0).toString(16),1===a.length?"0"+a:a}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),j.fn.parse.prototype=j.fn,k.hsla.to=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var b,c,d=a[0]/255,e=a[1]/255,f=a[2]/255,g=a[3],h=Math.max(d,e,f),i=Math.min(d,e,f),j=h-i,k=h+i,l=.5*k;return b=i===h?0:d===h?60*(e-f)/j+360:e===h?60*(f-d)/j+120:60*(d-e)/j+240,c=0===j?0:l<=.5?j/k:j/(2-k),[Math.round(b)%360,c,l,null==g?1:g]},k.hsla.from=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],f=a[3],g=d<=.5?d*(1+c):d+c-d*c,h=2*d-g;return[Math.round(255*e(h,g,b+1/3)),Math.round(255*e(h,g,b)),Math.round(255*e(h,g,b-1/3)),f]},o(k,function(d,e){var f=e.props,g=e.cache,i=e.to,k=e.from;j.fn[d]=function(d){if(i&&!this[g]&&(this[g]=i(this._rgba)),d===b)return this[g].slice();var e,h=a.type(d),l="array"===h||"object"===h?d:arguments,m=this[g].slice();return o(f,function(a,b){var d=l["object"===h?a:b.idx];null==d&&(d=m[b.idx]),m[b.idx]=c(d,b)}),k?(e=j(k(m)),e[g]=m,e):j(m)},o(f,function(b,c){j.fn[b]||(j.fn[b]=function(e){var f,g=a.type(e),i="alpha"===b?this._hsla?"hsla":"rgba":d,j=this[i](),k=j[c.idx];return"undefined"===g?k:("function"===g&&(e=e.call(this,k),g=a.type(e)),null==e&&c.empty?this:("string"===g&&(f=h.exec(e),f&&(e=k+parseFloat(f[2])*("+"===f[1]?1:-1))),j[c.idx]=e,this[i](j)))})})}),j.hook=function(b){var c=b.split(" ");o(c,function(b,c){a.cssHooks[c]={set:function(b,e){var f,g,h="";if("transparent"!==e&&("string"!==a.type(e)||(f=d(e)))){if(e=j(f||e),!m.rgba&&1!==e._rgba[3]){for(g="backgroundColor"===c?b.parentNode:b;(""===h||"transparent"===h)&&g&&g.style;)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(i){}e=e.blend(h&&"transparent"!==h?h:"_default")}e=e.toRgbaString()}try{b.style[c]=e}catch(i){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=j(b.elem,c),b.end=j(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},j.hook(g),a.cssHooks.borderColor={expand:function(a){var b={};return o(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},f=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(e),function(){function b(b){var c,d,e=b.ownerDocument.defaultView?b.ownerDocument.defaultView.getComputedStyle(b,null):b.currentStyle,f={};if(e&&e.length&&e[0]&&e[e[0]])for(d=e.length;d--;)c=e[d],"string"==typeof e[c]&&(f[a.camelCase(c)]=e[c]);else for(c in e)"string"==typeof e[c]&&(f[c]=e[c]);return f}function c(b,c){var d,e,g={};for(d in c)e=c[d],b[d]!==e&&(f[d]||!a.fx.step[d]&&isNaN(parseFloat(e))||(g[d]=e));return g}var d=["add","remove","toggle"],f={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(b,c){a.fx.step[c]=function(a){("none"!==a.end&&!a.setAttr||1===a.pos&&!a.setAttr)&&(e.style(a.elem,c,a.end),a.setAttr=!0)}}),a.fn.addBack||(a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a.effects.animateClass=function(e,f,g,h){var i=a.speed(f,g,h);return this.queue(function(){var f,g=a(this),h=g.attr("class")||"",j=i.children?g.find("*").addBack():g;j=j.map(function(){var c=a(this);return{el:c,start:b(this)}}),f=function(){a.each(d,function(a,b){e[b]&&g[b+"Class"](e[b])})},f(),j=j.map(function(){return this.end=b(this.el[0]),this.diff=c(this.start,this.end),this}),g.attr("class",h),j=j.map(function(){var b=this,c=a.Deferred(),d=a.extend({},i,{queue:!1,complete:function(){c.resolve(b)}});return this.el.animate(this.diff,d),c.promise()}),a.when.apply(a,j.get()).done(function(){f(),a.each(arguments,function(){var b=this.el;a.each(this.diff,function(a){b.css(a,"")})}),i.complete.call(g[0])})})},a.fn.extend({addClass:function(b){return function(c,d,e,f){return d?a.effects.animateClass.call(this,{add:c},d,e,f):b.apply(this,arguments)}}(a.fn.addClass),removeClass:function(b){return function(c,d,e,f){return arguments.length>1?a.effects.animateClass.call(this,{remove:c},d,e,f):b.apply(this,arguments)}}(a.fn.removeClass),toggleClass:function(b){return function(c,d,e,f,g){return"boolean"==typeof d||void 0===d?e?a.effects.animateClass.call(this,d?{add:c}:{remove:c},e,f,g):b.apply(this,arguments):a.effects.animateClass.call(this,{toggle:c},d,e,f)}}(a.fn.toggleClass),switchClass:function(b,c,d,e,f){return a.effects.animateClass.call(this,{add:c,remove:b},d,e,f)}})}(),function(){function e(b,c,d,e){return a.isPlainObject(b)&&(c=b,b=b.effect),b={effect:b},null==c&&(c={}),a.isFunction(c)&&(e=c,d=null,c={}),("number"==typeof c||a.fx.speeds[c])&&(e=d,d=c,c={}),a.isFunction(d)&&(e=d,d=null),c&&a.extend(b,c),d=d||c.duration,b.duration=a.fx.off?0:"number"==typeof d?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,b.complete=e||c.complete,b}function f(b){return!(b&&"number"!=typeof b&&!a.fx.speeds[b])||("string"==typeof b&&!a.effects.effect[b]||(!!a.isFunction(b)||"object"==typeof b&&!b.effect))}function g(a,b){var c=b.outerWidth(),d=b.outerHeight(),e=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,f=e.exec(a)||["",0,c,d,0];return{top:parseFloat(f[1])||0,right:"auto"===f[2]?c:parseFloat(f[2]),bottom:"auto"===f[3]?d:parseFloat(f[3]),left:parseFloat(f[4])||0}}a.expr&&a.expr.filters&&a.expr.filters.animated&&(a.expr.filters.animated=function(b){return function(c){return!!a(c).data(d)||b(c)}}(a.expr.filters.animated)),a.uiBackCompat!==!1&&a.extend(a.effects,{save:function(a,c){for(var d=0,e=c.length;d").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:b.width(),height:b.height()},f=document.activeElement;try{f.id}catch(g){f=document.body}return b.wrap(d),(b[0]===f||a.contains(b[0],f))&&a(f).trigger("focus"),d=b.parent(),"static"===b.css("position")?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),b.css(e),d.css(c).show()},removeWrapper:function(b){var c=document.activeElement;return b.parent().is(".ui-effects-wrapper")&&(b.parent().replaceWith(b),(b[0]===c||a.contains(b[0],c))&&a(c).trigger("focus")),b}}),a.extend(a.effects,{version:"1.12.1",define:function(b,c,d){return d||(d=c,c="effect"),a.effects.effect[b]=d,a.effects.effect[b].mode=c,d},scaledDimensions:function(a,b,c){if(0===b)return{height:0,width:0,outerHeight:0,outerWidth:0};var d="horizontal"!==c?(b||100)/100:1,e="vertical"!==c?(b||100)/100:1;return{height:a.height()*e,width:a.width()*d,outerHeight:a.outerHeight()*e,outerWidth:a.outerWidth()*d}},clipToBox:function(a){return{width:a.clip.right-a.clip.left,height:a.clip.bottom-a.clip.top,left:a.clip.left,top:a.clip.top}},unshift:function(a,b,c){var d=a.queue();b>1&&d.splice.apply(d,[1,0].concat(d.splice(b,c))),a.dequeue()},saveStyle:function(a){a.data(c,a[0].style.cssText)},restoreStyle:function(a){a[0].style.cssText=a.data(c)||"",a.removeData(c)},mode:function(a,b){var c=a.is(":hidden");return"toggle"===b&&(b=c?"show":"hide"),(c?"hide"===b:"show"===b)&&(b="none"),b},getBaseline:function(a,b){var c,d;switch(a[0]){case"top":c=0;break;case"middle":c=.5;break;case"bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case"left":d=0;break;case"center":d=.5;break;case"right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},createPlaceholder:function(c){var d,e=c.css("position"),f=c.position();return c.css({marginTop:c.css("marginTop"),marginBottom:c.css("marginBottom"),marginLeft:c.css("marginLeft"),marginRight:c.css("marginRight")}).outerWidth(c.outerWidth()).outerHeight(c.outerHeight()),/^(static|relative)/.test(e)&&(e="absolute",d=a("<"+c[0].nodeName+">").insertAfter(c).css({display:/^(inline|ruby)/.test(c.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:c.css("marginTop"),marginBottom:c.css("marginBottom"),marginLeft:c.css("marginLeft"),marginRight:c.css("marginRight"),"float":c.css("float")}).outerWidth(c.outerWidth()).outerHeight(c.outerHeight()).addClass("ui-effects-placeholder"),c.data(b+"placeholder",d)),c.css({position:e,left:f.left,top:f.top}),d},removePlaceholder:function(a){var c=b+"placeholder",d=a.data(c);d&&(d.remove(),a.removeData(c))},cleanUp:function(b){a.effects.restoreStyle(b),a.effects.removePlaceholder(b)},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(){function b(b){function e(){i.removeData(d),a.effects.cleanUp(i),"hide"===c.mode&&i.hide(),h()}function h(){a.isFunction(j)&&j.call(i[0]),a.isFunction(b)&&b()}var i=a(this);c.mode=l.shift(),a.uiBackCompat===!1||g?"none"===c.mode?(i[k](),h()):f.call(i[0],c,e):(i.is(":hidden")?"hide"===k:"show"===k)?(i[k](),h()):f.call(i[0],c,h)}var c=e.apply(this,arguments),f=a.effects.effect[c.effect],g=f.mode,h=c.queue,i=h||"fx",j=c.complete,k=c.mode,l=[],m=function(b){var c=a(this),e=a.effects.mode(c,k)||g;c.data(d,!0),l.push(e),g&&("show"===e||e===g&&"hide"===e)&&c.show(),g&&"none"===e||a.effects.saveStyle(c),a.isFunction(b)&&b()};return a.fx.off||!f?k?this[k](c.duration,j):this.each(function(){j&&j.call(this)}):h===!1?this.each(m).each(b):this.queue(i,m).queue(i,b)},show:function(a){return function(b){if(f(b))return a.apply(this,arguments);var c=e.apply(this,arguments);return c.mode="show",this.effect.call(this,c)}}(a.fn.show),hide:function(a){return function(b){if(f(b))return a.apply(this,arguments);var c=e.apply(this,arguments);return c.mode="hide",this.effect.call(this,c)}}(a.fn.hide),toggle:function(a){return function(b){if(f(b)||"boolean"==typeof b)return a.apply(this,arguments);var c=e.apply(this,arguments);return c.mode="toggle",this.effect.call(this,c)}}(a.fn.toggle),cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d},cssClip:function(a){return a?this.css("clip","rect("+a.top+"px "+a.right+"px "+a.bottom+"px "+a.left+"px)"):g(this.css("clip"),this)},transfer:function(b,c){var d=a(this),e=a(b.to),f="fixed"===e.css("position"),g=a("body"),h=f?g.scrollTop():0,i=f?g.scrollLeft():0,j=e.offset(),k={top:j.top-h,left:j.left-i,height:e.innerHeight(),width:e.innerWidth()},l=d.offset(),m=a("").appendTo("body").addClass(b.className).css({top:l.top-h,left:l.left-i,height:d.innerHeight(),width:d.innerWidth(),position:f?"fixed":"absolute"}).animate(k,b.duration,b.easing,function(){m.remove(),a.isFunction(c)&&c()})}}),a.fx.step.clip=function(b){b.clipInit||(b.start=a(b.elem).cssClip(),"string"==typeof b.end&&(b.end=g(b.end,b.elem)),b.clipInit=!0),a(b.elem).cssClip({top:b.pos*(b.end.top-b.start.top)+b.start.top,right:b.pos*(b.end.right-b.start.right)+b.start.right,bottom:b.pos*(b.end.bottom-b.start.bottom)+b.start.bottom,left:b.pos*(b.end.left-b.start.left)+b.start.left})}}(),function(){var b={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,c){b[c]=function(b){return Math.pow(b,a+2)}}),a.extend(b,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return 0===a||1===a?a:-Math.pow(2,8*(a-1))*Math.sin((80*(a-1)-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){for(var b,c=4;a<((b=Math.pow(2,--c))-1)/11;);return 1/Math.pow(4,3-c)-7.5625*Math.pow((3*b-2)/22-a,2)}}),a.each(b,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return a<.5?c(2*a)/2:1-c(a*-2+2)/2}})}(),a.effects});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-blind-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-blind-min.js
new file mode 100644
index 000000000..cf547b61b
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-blind-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("blind","hide",function(b,c){var d={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},e=a(this),f=b.direction||"up",g=e.cssClip(),h={clip:a.extend({},g)},i=a.effects.createPlaceholder(e);h.clip[d[f][0]]=h.clip[d[f][1]],"show"===b.mode&&(e.cssClip(h.clip),i&&i.css(a.effects.clipToBox(h)),h.clip=g),i&&i.animate(a.effects.clipToBox(h),b.duration,b.easing),e.animate(h,{queue:!1,duration:b.duration,easing:b.easing,complete:c})})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-bounce-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-bounce-min.js
new file mode 100644
index 000000000..77dd9b25b
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-bounce-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("bounce",function(b,c){var d,e,f,g=a(this),h=b.mode,i="hide"===h,j="show"===h,k=b.direction||"up",l=b.distance,m=b.times||5,n=2*m+(j||i?1:0),o=b.duration/n,p=b.easing,q="up"===k||"down"===k?"top":"left",r="up"===k||"left"===k,s=0,t=g.queue().length;for(a.effects.createPlaceholder(g),f=g.css(q),l||(l=g["top"===q?"outerHeight":"outerWidth"]()/3),j&&(e={opacity:1},e[q]=f,g.css("opacity",0).css(q,r?2*-l:2*l).animate(e,o,p)),i&&(l/=Math.pow(2,m-1)),e={},e[q]=f;s").css({position:"absolute",visibility:"visible",left:-g*r,top:-f*s}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:r,height:s,left:h+(p?j*r:0),top:i+(p?k*s:0),opacity:p?0:1}).animate({left:h+(p?0:j*r),top:i+(p?0:k*s),opacity:p?1:0},b.duration||500,b.easing,d)})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fade-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fade-min.js
new file mode 100644
index 000000000..99549873a
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fade-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("fade","toggle",function(b,c){var d="show"===b.mode;a(this).css("opacity",d?0:1).animate({opacity:d?1:0},{queue:!1,duration:b.duration,easing:b.easing,complete:c})})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fold-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fold-min.js
new file mode 100644
index 000000000..5c9a2bfbb
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-fold-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("fold","hide",function(b,c){var d=a(this),e=b.mode,f="show"===e,g="hide"===e,h=b.size||15,i=/([0-9]+)%/.exec(h),j=!!b.horizFirst,k=j?["right","bottom"]:["bottom","right"],l=b.duration/2,m=a.effects.createPlaceholder(d),n=d.cssClip(),o={clip:a.extend({},n)},p={clip:a.extend({},n)},q=[n[k[0]],n[k[1]]],r=d.queue().length;i&&(h=parseInt(i[1],10)/100*q[g?0:1]),o.clip[k[0]]=h,p.clip[k[0]]=h,p.clip[k[1]]=0,f&&(d.cssClip(p.clip),m&&m.css(a.effects.clipToBox(p)),p.clip=n),d.queue(function(c){m&&m.animate(a.effects.clipToBox(o),l,b.easing).animate(a.effects.clipToBox(p),l,b.easing),c()}).animate(o,l,b.easing).animate(p,l,b.easing).queue(c),a.effects.unshift(d,r,4)})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-highlight-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-highlight-min.js
new file mode 100644
index 000000000..eef2315ca
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-highlight-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("highlight","show",function(b,c){var d=a(this),e={backgroundColor:d.css("backgroundColor")};"hide"===b.mode&&(e.opacity=0),a.effects.saveStyle(d),d.css({backgroundImage:"none",backgroundColor:b.color||"#ffff99"}).animate(e,{queue:!1,duration:b.duration,easing:b.easing,complete:c})})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-puff-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-puff-min.js
new file mode 100644
index 000000000..c6ce2d9aa
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-puff-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect","./effect-scale"],a):a(jQuery)}(function(a){return a.effects.define("puff","hide",function(b,c){var d=a.extend(!0,{},b,{fade:!0,percent:parseInt(b.percent,10)||150});a.effects.effect.scale.call(this,d,c)})});
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-pulsate-min.js b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-pulsate-min.js
new file mode 100644
index 000000000..73da7af81
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/jquery_ui_effects/jquery.ui/ui/effects/effect-pulsate-min.js
@@ -0,0 +1,4 @@
+/*! jQuery UI - v1.12.1 - 2017-03-31
+* http://jqueryui.com
+* Copyright jQuery Foundation and other contributors; Licensed */
+!function(a){"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],a):a(jQuery)}(function(a){return a.effects.define("pulsate","show",function(b,c){var d=a(this),e=b.mode,f="show"===e,g="hide"===e,h=f||g,i=2*(b.times||5)+(h?1:0),j=b.duration/i,k=0,l=1,m=d.queue().length;for(!f&&d.is(":visible")||(d.css("opacity",0).show(),k=1);l' . t('About') . '';
+ $output .= '' . t('Drupal 8 includes jQuery UI in core, however it is no longer actively maintained and has been marked deprecated. This module provides the jQuery UI Effects library for any themes and modules that require it.') . '
';
+ $output .= '' . t('For more information about the deprecation of jQuery UI, see this change record', [':change-record' => 'https://www.drupal.org/node/3067969']) . '
';
+ $output .= '' . t('Visit the jQuery UI Effects project page on Drupal.org for more information.', [':project_link' => 'https://www.drupal.org/project/jquery_ui_effects']) . '
';
+
+ return $output;
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/LICENSE.txt b/frontend/drupal9/web/modules/contrib/menu_link_clone/LICENSE.txt
new file mode 100644
index 000000000..d159169d1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/README.md b/frontend/drupal9/web/modules/contrib/menu_link_clone/README.md
new file mode 100755
index 000000000..028c24707
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/README.md
@@ -0,0 +1,30 @@
+CONTENTS OF THIS FILE
+---------------------
+
+ * Introduction
+ * Requirements
+ * Installation
+ * Configuration
+
+INTRODUCTION
+------------
+
+The Menu Link Clone provide a functionality to clone menu link items
+at the time of clone any menu.
+
+REQUIREMENTS
+------------
+
+This module requires the following SDK:
+
+ * Entity Clone module.
+
+INSTALLATION
+------------
+ * Remember install Entity Clone module before enable the module.
+ * Install as you would normally install a contributed Drupal module.
+ See: https://www.drupal.org/node/895232 for further information.
+
+CONFIGURATION
+-------------
+ * No configuration required.
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/composer.json b/frontend/drupal9/web/modules/contrib/menu_link_clone/composer.json
new file mode 100644
index 000000000..6d18bd32b
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/composer.json
@@ -0,0 +1,17 @@
+{
+ "name": "drupal/menu_link_clone",
+ "description": "Allows clone the menu items.",
+ "type": "drupal-module",
+ "homepage": "https://www.drupal.org/project/menu_link_clone",
+ "support": {
+ "issues": "https://www.drupal.org/project/issues/menu_link_clone",
+ "source": "https://cgit.drupalcode.org/menu_link_clone"
+ },
+ "license": "GPL-2.0+",
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "require": {
+ "drupal/entity_clone": "^1.0",
+ "drupal/core": "^8 || ^9"
+ }
+}
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.info.yml b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.info.yml
new file mode 100644
index 000000000..fd8be06e7
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.info.yml
@@ -0,0 +1,12 @@
+name: Menu Link Clone
+description: Add a clone with link action for all menus
+core: "8.x"
+core_version_requirement: ^8 || ^9
+type: module
+dependencies:
+ - entity_clone:entity_clone
+
+# Information added by Drupal.org packaging script on 2020-03-05
+version: '8.x-3.2'
+project: 'menu_link_clone'
+datestamp: 1583388239
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.module b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.module
new file mode 100755
index 000000000..77bf538ca
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.module
@@ -0,0 +1,31 @@
+' . t('About') . '';
+ $output .= '' . t('Admin created menu link item cloning process.') . '
';
+ $output .= '' . t('Uses') . '
';
+ $output .= '' . t('Provides a checkbox on menu clone form that gives you permission to clone the menu links created by Admin.') . '
';
+ $output .= '' . t('Restrictions') . '
';
+ $output .= '' . t('We can only clone menu link items created by Admin (Not system generated menu link items).') . '
';
+ return $output;
+
+ default:
+ return;
+
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.services.yml b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.services.yml
new file mode 100755
index 000000000..24faf60c1
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/menu_link_clone.services.yml
@@ -0,0 +1,6 @@
+services:
+ menu_link_clone.route_subscriber:
+ class: Drupal\menu_link_clone\Routing\RouteSubscriber
+ arguments: ['@entity_type.manager']
+ tags:
+ - { name: event_subscriber }
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Form/EntityMenuLinkCloneForm.php b/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Form/EntityMenuLinkCloneForm.php
new file mode 100755
index 000000000..3ca546381
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Form/EntityMenuLinkCloneForm.php
@@ -0,0 +1,259 @@
+get('entity_type.manager'),
+ $container->get('current_route_match'),
+ $container->get('string_translation'),
+ $container->get('event_dispatcher'),
+ $container->get('messenger'),
+ $container->get('uuid')
+ );
+ }
+
+ /**
+ * Constructs a clone menu lines with parent construct.
+ *
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * The entity type manager.
+ * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
+ * The route match service.
+ * @param \Drupal\Core\StringTranslation\TranslationManager $string_translation
+ * The string translation manager.
+ * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
+ * The event dispatcher service.
+ * @param \Drupal\Core\Messenger\Messenger $messenger
+ * The messenger service.
+ * @param \Drupal\Component\Uuid\Php $uuid_interface
+ * Generate unique id(uuid).
+ */
+ public function __construct(EntityTypeManagerInterface $entity_type_manager, RouteMatchInterface $route_match, TranslationManager $string_translation, EventDispatcherInterface $eventDispatcher, Messenger $messenger, Php $uuid_interface) {
+ parent::__construct($entity_type_manager, $route_match, $string_translation, $eventDispatcher, $messenger);
+ $this->uuidinterface = $uuid_interface;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @return array
+ * A render form array for a page.
+ */
+ public function buildForm(array $form, FormStateInterface $form_state) {
+ $form = parent::buildForm($form, $form_state);
+ $form['clone_links'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Clone with Links'),
+ '#required' => FALSE,
+ '#default_value' => FALSE,
+ '#weight' => 0,
+ ];
+ return $form;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function submitForm(array &$form, FormStateInterface $form_state) {
+ parent::submitForm($form, $form_state);
+ $cloneLink = $form_state->getValue('clone_links');
+ if ($cloneLink) {
+ $sourceMenuId = $this->entity->id();
+ $destMenuId = $form_state->getValue('id');
+ $sourceMenuExistence = $this->menuLinksAvailabilityCheck($sourceMenuId);
+ if (!$sourceMenuExistence) {
+ $this->messenger->addMessage($this->t('Self(Admin) created menu links are not available in @label menu.', ['@label' => $this->entity->label()]));
+ }
+ else {
+ $result = $this->cloneMenuLinks($sourceMenuId, $destMenuId);
+ if ($result) {
+ $this->messenger->addMessage($this->t('Self(Admin) created Links are cloned successfully for @label menu.', ['@label' => $form_state->getValue('label')]));
+ }
+ else {
+ $this->messenger->addMessage($this->t('Unsuccessfull to clone links for @label, Please try again or contact to site admin.', ['@label' => $form_state->getValue('label')]));
+ }
+ }
+ }
+ $response = Url::fromRoute('entity.menu.collection');
+ $form_state->setRedirectUrl($response);
+ }
+
+ /**
+ * Clone menu items.
+ *
+ * @param object $source_menu_name
+ * Source menu name from we need to clone the menu items.
+ * @param string $target_menu_name
+ * Destination menu name to clone the menu items.
+ *
+ * @return bool
+ * Return the True or False.
+ */
+ protected function cloneMenuLinks($source_menu_name, $target_menu_name) {
+ $result = FALSE;
+ $menuLinkItems = $this->getMenuItems($source_menu_name);
+ if ($menuLinkItems['status']) {
+ $data = $this->resetLinkItems($menuLinkItems['items']);
+ $data = $this->setUuidForMenuItems($data, $target_menu_name);
+ $data = $this->createMenuLinkClone($data);
+ if ($data) {
+ $result = TRUE;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Get menu items ids.
+ *
+ * @param string $menu_id
+ * Menu name for which we can get there items.
+ *
+ * @return array
+ * Retrun array with there menu items tree.
+ */
+ protected function getMenuItems($menu_id) {
+ $result = [];
+ $storage = $this->entityTypeManager->getStorage('menu_link_content');
+ $menuLinkItems = $storage->loadByProperties(['menu_name' => $menu_id]);
+ if (!empty($menuLinkItems)) {
+ $result['status'] = TRUE;
+ $result['items'] = $menuLinkItems;
+ }
+ else {
+ $result['status'] = FALSE;
+ $result['items'] = [];
+ }
+ return $result;
+ }
+
+ /**
+ * Check Menu Link items are availabe inside the menu.
+ *
+ * @param string $source_menu_id
+ * Menu name for which we need to check their items.
+ *
+ * @return bool
+ * Return True and False.
+ */
+ protected function menuLinksAvailabilityCheck($source_menu_id) {
+ $result = FALSE;
+ if (!empty($source_menu_id)) {
+ $menuLinkItems = $this->getMenuItems($source_menu_id);
+ if ($menuLinkItems['status']) {
+ $result = TRUE;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Reset elements in menu item object.
+ *
+ * @param object $menu_links_object_multiple
+ * Menu Items Object.
+ *
+ * @return array
+ * Retrun array with there menu items tree.
+ */
+ protected function resetLinkItems($menu_links_object_multiple) {
+ $result = [];
+ foreach ($menu_links_object_multiple as $link) {
+ if (!empty($link)) {
+ $linkArray = $link->toArray();
+ $linkData = [];
+ foreach ($linkArray as $key => $linkArrayItem) {
+ $linkData[$key] = reset($linkArrayItem);
+ }
+ $result[$link->id()] = $linkData;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Set UUID for menu items.
+ *
+ * @param object $menu_links_object_multiple
+ * Menu Items Object.
+ * @param string $target_menu_name
+ * Menu Name for which we need to set UUID.
+ *
+ * @return array
+ * Retrun array with there menu items tree.
+ */
+ protected function setUuidForMenuItems($menu_links_object_multiple, $target_menu_name) {
+ $uuid_map = [];
+ // Create an uuid mapping table.
+ foreach ($menu_links_object_multiple as $id => $menu) {
+ $uuid = $menu['uuid']['value'];
+ // Assume uuid is not duplicated here.
+ $new_uuid = $this->uuidinterface->generate();
+ $uuid_map['menu_link_content:' . $uuid] = 'menu_link_content:' . $new_uuid;
+ $menu_links_object_multiple[$id]['uuid'] = $new_uuid;
+ unset($menu_links_object_multiple[$id]['id']);
+ $menu_links_object_multiple[$id]['menu_name'] = $target_menu_name;
+ if (isset($menu_links_object_multiple[$id]['parent']['value']) && !empty($menu_links_object_multiple[$id]['parent']['value'])) {
+ $menu_links_object_multiple[$id]['parent']['value'] = $uuid_map[$menu_links_object_multiple[$id]['parent']['value']];
+ }
+ }
+ return $menu_links_object_multiple;
+ }
+
+ /**
+ * Create menu links.
+ *
+ * @param object $menu_links_object_multiple
+ * Menu Items Object.
+ *
+ * @return array
+ * Retrun array with there menu items tree.
+ */
+ protected function createMenuLinkClone($menu_links_object_multiple) {
+ $result = FALSE;
+ foreach ($menu_links_object_multiple as $id => $menu) {
+ if (isset($id) && !empty($id)) {
+ unset($menu['revision_id']);
+ unset($menu['bundle']);
+ $save_menu = MenuLinkContent::create($menu);
+ $save_menu->save();
+ if ($save_menu) {
+ $result = TRUE;
+ }
+ }
+ }
+ return $result;
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Routing/RouteSubscriber.php b/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Routing/RouteSubscriber.php
new file mode 100755
index 000000000..e2303b62d
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/src/Routing/RouteSubscriber.php
@@ -0,0 +1,42 @@
+entityTypeManager = $entity_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterRoutes(RouteCollection $collection) {
+ $menu = $this->entityTypeManager->getDefinition('menu')->id();
+ if ($menu) {
+ if ($route = $collection->get("entity.$menu.clone_form")) {
+ $route->setDefault('_form', '\Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm');
+ }
+ }
+ }
+
+}
diff --git a/frontend/drupal9/web/modules/contrib/menu_link_clone/tests/src/Functional/MenuLinkCloneTest.php b/frontend/drupal9/web/modules/contrib/menu_link_clone/tests/src/Functional/MenuLinkCloneTest.php
new file mode 100644
index 000000000..d9ab67e0e
--- /dev/null
+++ b/frontend/drupal9/web/modules/contrib/menu_link_clone/tests/src/Functional/MenuLinkCloneTest.php
@@ -0,0 +1,88 @@
+adminUser = $this->drupalCreateUser($this->permissions);
+ $this->drupalLogin($this->adminUser);
+ }
+
+ /**
+ * Test menu link clone.
+ */
+ public function testMenuLinkClone() {
+ $entityTypeManager = $this->container->get('entity_type.manager');
+ $menus = $entityTypeManager->getStorage('menu')->loadByProperties(['id' => 'account']);
+ $menu = reset($menus);
+
+ // Custom menu link.
+ $menu_link = MenuLinkContent::create([
+ 'title' => 'Test',
+ 'link' => ['uri' => 'internal:/'],
+ 'menu_name' => 'account',
+ 'expanded' => TRUE,
+ 'weight' => 0,
+ ]);
+ $menu_link->save();
+
+ $edit = [
+ 'label' => 'Test menu cloned',
+ 'id' => 'test_menu_cloned',
+ 'clone_links' => TRUE,
+ ];
+ $this->drupalPostForm('entity_clone/menu/' . $menu->id(), $edit, t('Clone'));
+
+ $menus = $entityTypeManager->getStorage('menu')->loadByProperties(['id' => $edit['id']]);
+ $menu = reset($menus);
+ $this->assertNotEmpty($menu, 'Test menu cloned found in database.');
+
+ $menuLink = $entityTypeManager->getStorage('menu_link_content')->loadByProperties(['menu_name' => $edit['id']]);
+ $menuLink = reset($menuLink);
+ $this->assertNotEmpty($menuLink, "Menu link found in database for Test menu cloned");
+ }
+
+}