모듈을 설치하고 제거 할 때 실행되는 Drupal 후크?
-
14-11-2019 - |
문제
사용자 정의 후크를 실행하기 위해 Drupal을 얻으려고합니다.모듈이 설치되고 모듈이 UnistAlled가 될 때 모듈이 설치 될 때 실행 해야하는 것.모듈을 설치하거나 제거하는 동안 Drupal을 실행하는 데 사용할 수있는 후크 또는 트리거가 있습니까?실행 해야하는 후크는 배열에서 분류학 용어를 빌드합니다.나는 hook_schema에 배치를 기반으로합니다.이 훅의 구현 예는 다음과 같습니다.
function mymodule_install_taxonomy() {
return array(
<<Taxonomy Structure Here>>
);
}
.
이 코드는 .install 파일에 배치됩니다.
해결책
When your own module is installed or for others?
For your own, there is hook_install() (only called the first time your module is installed, usually used to install the schema defined in hook_schema() in Drupal 6, this is automated in Drupal 7), hook_uninstall(), hook_enable() (called every time your module is enabled) and finally hook_disable() (when your module is disabled).
Drupal 7 has also added a similar set of hooks that is however called when other modules are installed, uninstalled, enabled or disabled, see hook_modules_*()