public function ConfigurationUpdateHookGenerator::generate in Update helper 8
Generator Update N function.
Parameters
string $module: Module name where update will be generated.
string $update_number: Update number that will be used.
string $description: Description displayed for update hook function.
File
- src/
Generator/ ConfigurationUpdateHookGenerator.php, line 57
Class
- ConfigurationUpdateHookGenerator
- Update hook generator for generate:configuration:update console command.
Namespace
Drupal\update_helper\GeneratorCode
public function generate($module, $update_number, $description = '') {
$module_path = $this->moduleHandler
->getModule($module)
->getPath();
$update_file = $module_path . '/' . $module . '.install';
$this
->addSkeletonDir(__DIR__ . '/../../templates/console');
$parameters = [
'description' => $description,
'module' => $module,
'update_hook_name' => $this
->getUpdateFunctionName($module, $update_number),
'file_exists' => file_exists($update_file),
];
$this
->renderFile('configuration_update_hook.php.twig', $update_file, $parameters, FILE_APPEND);
}