public static function WebformAccessGroupListBuilder::buildEntities in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_access/src/WebformAccessGroupListBuilder.php \Drupal\webform_access\WebformAccessGroupListBuilder::buildEntities()
Build a renderable array of entities.
Parameters
array $entity_references: The entity references (i.e. entity_type:entity_id) to be rendered.
Return value
array A renderable array of entities.
2 calls to WebformAccessGroupListBuilder::buildEntities()
- WebformAccessGroupForm::form in modules/
webform_access/ src/ WebformAccessGroupForm.php - Gets the actual form array to be built.
- WebformAccessGroupListBuilder::buildRow in modules/
webform_access/ src/ WebformAccessGroupListBuilder.php - Builds a row for an entity in the entity listing.
File
- modules/
webform_access/ src/ WebformAccessGroupListBuilder.php, line 294
Class
- WebformAccessGroupListBuilder
- Defines a class to build a listing of webform access group entities.
Namespace
Drupal\webform_accessCode
public static function buildEntities(array $entity_references) {
$items = [];
foreach ($entity_references as $entity_reference) {
list($entity_type, $entity_id, $field_name, $webform_id) = explode(':', $entity_reference);
$entity = \Drupal::entityTypeManager()
->getStorage($entity_type)
->load($entity_id);
$webform = \Drupal::entityTypeManager()
->getStorage('webform')
->load($webform_id);
if ($entity && $webform) {
$items[] = [
'source_entity' => $entity
->toLink()
->toRenderable(),
'webform' => [
'#prefix' => '<br/>',
'#markup' => $webform
->label(),
],
];
}
}
return [
'#theme' => 'item_list',
'#items' => $items,
];
}