From 9835380994bcfa25c22090a59d815056fc74cfe1 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Wed, 4 Dec 2013 01:00:26 -0800 Subject: [PATCH] Issue #2148211 by alexpott: Use isSyncing flag to prevent creation of configuration entities on synchronisation. --- .../lib/Drupal/custom_block/Entity/CustomBlockType.php | 4 +++- core/modules/comment/comment.module | 2 +- core/modules/user/user.module | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php index 345c210e7df1..c6340c641778 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php @@ -87,7 +87,9 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ if (!$update) { entity_invoke_bundle_hook('create', 'custom_block', $this->id()); - custom_block_add_body_field($this->id); + if (!$this->isSyncing()) { + custom_block_add_body_field($this->id); + } } elseif ($this->getOriginalId() != $this->id) { entity_invoke_bundle_hook('rename', 'custom_block', $this->getOriginalId(), $this->id); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 6fcbc2be43a7..f4533d922732 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -251,7 +251,7 @@ function comment_count_unpublished() { * Implements hook_ENTITY_TYPE_create() for 'field_instance'. */ function comment_field_instance_create(FieldInstanceInterface $instance) { - if ($instance->getFieldType() == 'comment') { + if ($instance->getFieldType() == 'comment' && !$instance->isSyncing()) { \Drupal::service('comment.manager')->addBodyField($instance->entity_type, $instance->getFieldName()); \Drupal::cache()->delete('comment_entity_info'); // Assign default values for the field instance. diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 5751f0273660..91e18d58611d 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1433,8 +1433,8 @@ function user_role_names($membersonly = FALSE, $permission = NULL) { * Implements hook_user_role_insert(). */ function user_user_role_insert(RoleInterface $role) { - // Ignore the authenticated and anonymous roles. - if (in_array($role->id(), array(DRUPAL_AUTHENTICATED_RID, DRUPAL_ANONYMOUS_RID))) { + // Ignore the authenticated and anonymous roles or the role is being synced. + if (in_array($role->id(), array(DRUPAL_AUTHENTICATED_RID, DRUPAL_ANONYMOUS_RID)) || $role->isSyncing()) { return; } @@ -1470,8 +1470,8 @@ function user_user_role_insert(RoleInterface $role) { * Implements hook_user_role_delete(). */ function user_user_role_delete(RoleInterface $role) { - // Ignore the authenticated and anonymous roles. - if (in_array($role->id(), array(DRUPAL_AUTHENTICATED_RID, DRUPAL_ANONYMOUS_RID))) { + // Ignore the authenticated and anonymous roles or the role is being synced. + if (in_array($role->id(), array(DRUPAL_AUTHENTICATED_RID, DRUPAL_ANONYMOUS_RID)) || $role->isSyncing()) { return; } -- GitLab