By xano on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
hook_tokens and hook_token_info still exist with few minor changes. refer(https://www.drupal.org/node/2277677 & https://www.drupal.org/node/1776688)
All code from /includes/token.inc has now been moved to \Drupal\Core\Utility\Token, which is accessible as the "token" service.
Drupal 7:
token_replace();
token_scan();
token_info();
token_generate();
token_find_with_prefix();
Drupal 8:
$token_service = \Drupal::token();
// or
$token_service = \Drupal::service('token');
$token_service->replace();
$token_service->scan();
$token_service->getInfo();
$token_service->generate();
$token_service->findWithPrefix();
Impacts:
Module developers