You are here

protected function WebformEntityReferenceManager::getParagraphFieldNames in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformEntityReferenceManager.php \Drupal\webform\WebformEntityReferenceManager::getParagraphFieldNames()

Get paragraph field names.

Parameters

\Drupal\Core\Entity\EntityInterface|null $entity: A fieldable content entity.

Return value

array An array of paragraph field names.

1 call to WebformEntityReferenceManager::getParagraphFieldNames()
WebformEntityReferenceManager::getParagraphWebformsRecursive in src/WebformEntityReferenceManager.php
Get webform associate with a paragraph field from entity.

File

src/WebformEntityReferenceManager.php, line 325

Class

WebformEntityReferenceManager
Webform entity reference (field) manager.

Namespace

Drupal\webform

Code

protected function getParagraphFieldNames(EntityInterface $entity) {
  $fields = $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->loadByProperties([
    'entity_type' => $entity
      ->getEntityTypeId(),
    'type' => 'entity_reference_revisions',
  ]);
  $field_names = [];
  foreach ($fields as $field) {
    if ($field
      ->getSetting('target_type') === 'paragraph') {
      $field_name = $field
        ->get('field_name');
      $field_names[$field_name] = $field_name;
    }
  }
  return $field_names;
}