Issue #2148211 by alexpott: Use isSyncing flag to prevent creation of configuration entities on synchronisation.

8.0.x
webchick 2013-12-04 01:00:26 -08:00
parent 6cd88832e7
commit 9835380994
3 changed files with 8 additions and 6 deletions

View File

@ -87,7 +87,9 @@ class CustomBlockType extends ConfigEntityBase implements CustomBlockTypeInterfa
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);

View File

@ -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.

View File

@ -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;
}