public function TeamListBuilder::render in Apigee Edge 8
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 EdgeEntityListBuilder::render
File
- modules/
apigee_edge_teams/ src/ Entity/ ListBuilder/ TeamListBuilder.php, line 117
Class
- TeamListBuilder
- General entity listing builder for teams.
Namespace
Drupal\apigee_edge_teams\Entity\ListBuilderCode
public function render() {
$build = parent::render();
$account = $this->entityTypeManager
->getStorage('user')
->load(\Drupal::currentUser()
->id());
$build = empty($build['table']) ? $build : $build['table'];
$build['#cache']['keys'][] = 'team_list_per_user';
// Team lists vary for each user and their permissions.
// Note: Even though cache contexts will be optimized to only include the
// 'user' cache context, the element should be invalidated correctly when
// permissions change because the 'user.permissions' cache context defined
// cache tags for permission changes, which should have bubbled up for the
// element when it was optimized away.
// @see \Drupal\KernelTests\Core\Cache\CacheContextOptimizationTest
$build['#cache']['contexts'][] = 'user';
$build['#cache']['contexts'][] = 'user.permissions';
$build['#cache']['tags'] = Cache::mergeTags($build['#cache']['tags'], $account
->getCacheTags());
// Use cache expiration defined in configuration.
$build['#cache']['max-age'] = $this->configFactory
->get('apigee_edge_teams.team_settings')
->get('cache_expiration');
return $build;
}