Skip to content

Commit

Permalink
cache tag all the things also fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
qadan committed Jul 31, 2020
1 parent b60890d commit 47ba163
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Access/EmbargoedAccessResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function setEmbargoMessage(EntityInterface $entity) {
$expiration_date = $expiration ? $embargo->getExpirationDate() : '';
$args = [
'%date' => $expiration_date,
'%ip_range' => $ip_range->label(),
'%ip_range' => $ip_range ? $ip_range->label() : '',
];
// Determine a message to set.
if (!$type && is_null($ip_range) && !$expiration) {
Expand Down
4 changes: 3 additions & 1 deletion src/Controller/EmbargoesNodeEmbargoesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public function showEmbargoes(NodeInterface $node = NULL) {
}

$formatted_emails = [
'#markup' => implode('<br>', $embargo->getAdditionalEmails()),
'data' => [
'#markup' => implode('<br>', $embargo->getAdditionalEmails()),
],
];

$row = [
Expand Down
19 changes: 6 additions & 13 deletions src/Plugin/Block/EmbargoesEmbargoPoliciesBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function create(ContainerInterface $container, array $configuratio
* An entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ResettableStackedRouteMatchInterface $route_match, EmbargoesEmbargoesServiceInterface $embargoes, EntityTypeManagerInterface $entity_manager) {
parent::construct($configuration, $plugin_id, $plugin_definition);
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->routeMatch = $route_match;
$this->embargoes = $embargoes;
$this->entityManager = $entity_manager;
Expand Down Expand Up @@ -103,7 +103,7 @@ public function build() {
$embargo_info['expiration'] = $t->translate('Duration: Indefinite');
}
else {
$embargo_info['expiration'] = $t->translate('Duration: @duration', [
$embargo_info['expiration'] = $t->translate('Duration: Until @duration', [
'@duration' => $embargo->getExpirationDate(),
]);
}
Expand All @@ -115,7 +115,7 @@ public function build() {
$embargo_info['type'] = $t->translate('Disallow Access To: Resource');
}
// Exempt IP string.
if (is_null($embargo->getExemptIps())) {
if (!($embargo->getExemptIps())) {
$embargo_info['exempt_ips'] = '';
}
else {
Expand All @@ -129,24 +129,17 @@ public function build() {
}

return [
'#theme' => 'embargo_policies',
'#theme' => 'embargoes_policies',
'#count' => $embargoes_count,
'#embargo_info' => $embargo_info,
'#embargo_info' => $embargoes_info,
'#cache' => [
'tags' => $cache_tags,
];
],
];
}
}

return [];
}

/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return 0;
}

}

0 comments on commit 47ba163

Please sign in to comment.