- 🇳🇿New Zealand quietone
Statistics is approved for removal. See 🌱 [Policy] Deprecate Statistics module in D10 and move to contrib in D11 Fixed
This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project → and the Extensions approved for removal → policies.
It will be moved to a contributed Statistics project once the project is created and the Drupal 11 branch is open.
- Status changed to Active
about 1 year ago 9:18am 25 October 2023 - 🇩🇪Germany Anybody Porta Westfalica
On it here now. We might need to move the implementation / patch over into contrib then, once the project exists.
- 🇩🇪Germany Anybody Porta Westfalica
Okay just looked into the code and saw, that statistics is already part of the "links" pseudo field:
/** * Implements hook_node_links_alter(). */ function statistics_node_links_alter(array &$links, NodeInterface $entity, array &$context) { if ($context['view_mode'] != 'rss') { $links['#cache']['contexts'][] = 'user.permissions'; if (\Drupal::currentUser()->hasPermission('view post access counter')) { $statistics = \Drupal::service('statistics.storage.node')->fetchView($entity->id()); if ($statistics) { $statistics_links['statistics_counter']['title'] = \Drupal::translation()->formatPlural($statistics->getTotalCount(), '1 view', '@count views'); $links['statistics'] = [ '#theme' => 'links__node__statistics', '#links' => $statistics_links, '#attributes' => ['class' => ['links', 'inline']], ]; } $links['#cache']['max-age'] = \Drupal::config('statistics.settings')->get('display_max_age'); } } }
So we should eventually turn this into a discussion about separating this out of the links field and into a separate field?