Hi! TY for the module.
I'm get error.
LogicException: Getting the base fields is not supported for entity type Block. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 201 of /var/www/html/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php).

I'm change|correction function paragraphs_clean_entity_presave

function paragraphs_clean_entity_presave(EntityInterface $entity) {
  /** @var \Drupal\Core\Entity\EntityFieldManager $fieldManager */
  $fieldManager = \Drupal::service('entity_field.manager');
  $parentEntities = $fieldManager->getFieldMapByFieldType('entity_reference_revisions');

  if (!array_key_exists($entity->getEntityTypeId(), $parentEntities)) {
    return;
  }

  $field_definitions = [];
  foreach ($parentEntities[$entity->getEntityTypeId()] as $field_id => $settings) {
    $field_definitions[] = FieldConfig::loadByName($entity->getEntityTypeId(), $entity->bundle(), $field_id);
  }

  if (empty($field_definitions)){
    return;
  }

  foreach ($field_definitions as $field_definition) {
    if ($field_definition->getSetting('target_type') == 'paragraph') {

And created patch.

Comments

batkor created an issue. See original summary.

batkor’s picture

StatusFileSize
new1.57 KB

Add import class for FieldConfig

andypost’s picture

Status: Active » Needs review
aaronbauman’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Needs review » Needs work

Please update to latest 1.x-dev version - patch does not apply
Let me know if that fixes it.
If so I'll push a new release.
Someone else ran into a similar issue.

batkor’s picture

StatusFileSize
new2.17 KB

Hi!
I'm correction patch for dev version, add check origin object and check load fieldConfig.

batkor’s picture

Status: Needs work » Needs review
krzysztof domański’s picture

StatusFileSize
new2.51 KB
new1.74 KB

Small correction (coding standard).

aaronbauman’s picture

The additional check to make sure the field(s) exist is good, but I think we should keep the FieldableEntityInterface check as well.
Is there any good reason to remove this?

-  // Check to make sure method exists.
-  if (!($entity instanceof FieldableEntityInterface)) {
krzysztof domański’s picture

StatusFileSize
new2.56 KB
new755 bytes

I agree that we should leave this condition. But, let's change the comment.

 function paragraphs_clean_entity_update(EntityInterface $entity) {
-  // Check to make sure method exists.
+  // Only act on content entities.
   if (!($entity instanceof FieldableEntityInterface)) {
     return;
   }
aaronbauman’s picture

Looks good to me.
I will test it tomorrow to make sure.

aaronbauman’s picture

Status: Needs review » Fixed

Committed, thank you for your work!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.