protected function ParagraphCloneForm::getPotentialCloneDestinations in Paragraphs Edit 8
1 call to ParagraphCloneForm::getPotentialCloneDestinations()
- ParagraphCloneForm::form in src/
ParagraphCloneForm.php - Gets the actual form array to be built.
File
- src/
ParagraphCloneForm.php, line 119
Class
Namespace
Drupal\paragraphs_editCode
protected function getPotentialCloneDestinations($paragraph_type) {
$bundles_labels = node_type_get_names();
$types_with_paragraphs = $this->entityManager
->getFieldMapByFieldType('entity_reference_revisions');
$field_definitions_bundle = [];
$destinations = [];
foreach ($types_with_paragraphs['node'] as $field => $info) {
foreach ($info['bundles'] as $bundle) {
if (!isset($field_definitions_bundle[$bundle])) {
$field_definitions_bundle[$bundle] = $this->entityManager
->getFieldDefinitions('node', $bundle);
}
/** @var \Drupal\field\FieldConfigInterface $field_definition */
$field_definition = $field_definitions_bundle[$bundle][$field];
$destinations['bundles'][$bundle] = $bundles_labels[$bundle];
$destinations['fields'][$bundle][$field] = $field_definition
->getLabel();
}
}
return $destinations;
}