Drupal.orgのAPIに見ると、私はそれに気づいhook_init()が変更レコードを見るとDrupalの8のために文書化されていない、私が見つかりました。ブートストラップは、もはや存在しフックしないためのポイント、すべての「ブートストラップ」のフックを取り除く、ブートストラップフックをであると言われているhook_boot()
とhook_exit()
、何も言われていませんhook_init()
。
Drupal 8のソースでhook_initを検索したところ、次のコードが見つかりました。1つ目はhook_init()
、コメントへの参照です。他の2つはhook_init()
実装のように見えますが、どちらも私が予期していないパラメーターを受け取ります。
function overlay_enable() {
if (strpos(current_path(), 'admin/modules') === 0) {
// Flag for a redirect to <front>#overlay=admin/modules on hook_init().
$_SESSION['overlay_enable_redirect'] = 1;
}
}
/**
* Implements hook_init().
*/
function phptemplate_init($template) {
$file = dirname($template->filename) . '/' . $template->name . '.theme';
if (file_exists($file)) {
include_once DRUPAL_ROOT . '/' . $file;
}
}
/**
* Implements hook_init().
*/
function twig_init($template) {
$file = dirname($template->filename) . '/' . $template->name . '.theme';
if (file_exists($file)) {
include_once DRUPAL_ROOT . '/' . $file;
}
}
また、呼び出す関数を探しましたが、hook_init()
見つかりませんでした。
hook_init()
Drupal 8 ではまだ使用されていますか?使用されなくなった場合、Drupal 7コードの実装を変換するにはどうすればよいhook_init()
ですか?