public function MappingListBuilder::render in GatherContent 8.5
Same name and namespace in other branches
- 8.4 gathercontent_ui/src/MappingListBuilder.php \Drupal\gathercontent_ui\MappingListBuilder::render()
Builds the entity listing as renderable array for table.html.twig.
@todo Add a link to add a new item to the #empty text.
Overrides EntityListBuilder::render
File
- gathercontent_ui/
src/ MappingListBuilder.php, line 163
Class
- MappingListBuilder
- Provides a listing of GatherContent Mapping entities.
Namespace
Drupal\gathercontent_uiCode
public function render() {
$account_id = DrupalGatherContentClient::getAccountId();
if (!$account_id) {
return parent::render();
}
$entityStorage = $this->entityTypeManager
->getStorage('gathercontent_mapping');
$projects = $this->client
->getActiveProjects($account_id);
foreach ($projects['data'] as $project) {
$mappings = $entityStorage
->loadByProperties([
'gathercontent_project_id' => $project->id,
]);
if (!$mappings) {
continue;
}
$remote_templates = $this->client
->templatesGet($project->id);
foreach ($remote_templates['data'] as $remote_template) {
$this->templates[$remote_template->id] = strtotime($remote_template->updatedAt);
}
}
return parent::render();
}