Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

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);
}
}