updated core and modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-09-09 16:27:51 +02:00
parent 027aa99b32
commit 41863f872c
7810 changed files with 318922 additions and 83631 deletions
+11 -11
View File
@@ -11,23 +11,23 @@ use Drupal\Core\Render\BubbleableMetadata;
* Implements hook_token_info().
*/
function statistics_token_info() {
$node['total-count'] = array(
$node['total-count'] = [
'name' => t("Number of views"),
'description' => t("The number of visitors who have read the node."),
);
$node['day-count'] = array(
];
$node['day-count'] = [
'name' => t("Views today"),
'description' => t("The number of visitors who have read the node today."),
);
$node['last-view'] = array(
];
$node['last-view'] = [
'name' => t("Last view"),
'description' => t("The date on which a visitor last read the node."),
'type' => 'date',
);
];
return array(
'tokens' => array('node' => $node),
);
return [
'tokens' => ['node' => $node],
];
}
/**
@@ -36,7 +36,7 @@ function statistics_token_info() {
function statistics_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$token_service = \Drupal::token();
$replacements = array();
$replacements = [];
if ($type == 'node' & !empty($data['node'])) {
$node = $data['node'];
@@ -58,7 +58,7 @@ function statistics_tokens($type, $tokens, array $data, array $options, Bubbleab
if ($created_tokens = $token_service->findWithPrefix($tokens, 'last-view')) {
$statistics = statistics_get($node->id());
$replacements += $token_service->generate('date', $created_tokens, array('date' => $statistics['timestamp']), $options, $bubbleable_metadata);
$replacements += $token_service->generate('date', $created_tokens, ['date' => $statistics['timestamp']], $options, $bubbleable_metadata);
}
}