public static function WebformSourceEntityManager::getMainSourceEntity in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformSourceEntityManager.php \Drupal\webform\Plugin\WebformSourceEntityManager::getMainSourceEntity()
Get the main source entity. Applies to only paragraphs.
Parameters
\Drupal\Core\Entity\EntityInterface $source_entity: A source entity.
Return value
\Drupal\Core\Entity\EntityInterface The main source entity.
See also
\Drupal\webform\Plugin\Field\FieldFormatter\WebformEntityReferenceEntityFormatter::viewElements
\Drupal\webform\Plugin\WebformSourceEntity\QueryStringWebformSourceEntity::getSourceEntity
2 calls to WebformSourceEntityManager::getMainSourceEntity()
- WebformEntityReferenceEntityFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ WebformEntityReferenceEntityFormatter.php - Builds a renderable array for a field value.
- WebformSubmissionForm::setEntity in src/
WebformSubmissionForm.php - This is the best place to override an entity form's default settings because it is called immediately after the form object is initialized.
File
- src/
Plugin/ WebformSourceEntityManager.php, line 67
Class
- WebformSourceEntityManager
- Webform source entity plugin manager.
Namespace
Drupal\webform\PluginCode
public static function getMainSourceEntity(EntityInterface $source_entity) {
if (\Drupal::moduleHandler()
->moduleExists('paragraphs')) {
while ($source_entity instanceof \Drupal\paragraphs\Entity\Paragraph) {
$source_entity = $source_entity
->getParentEntity();
}
}
return $source_entity;
}