Commit 98353809 authored by webchick's avatar webchick

Issue #2148211 by alexpott: Use isSyncing flag to prevent creation of...

Issue #2148211 by alexpott: Use isSyncing flag to prevent creation of configuration entities on synchronisation.
parent 6cd88832
......@@ -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);
......
......@@ -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.
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment