function tmgmt_translator_auto_create in Translation Management Tool 7
Same name and namespace in other branches
- 8 tmgmt.module \tmgmt_translator_auto_create()
Auto creates a translator from a translator plugin definition.
Parameters
$plugin: The machine-readable name of a translator plugin.
Related topics
1 call to tmgmt_translator_auto_create()
- tmgmt_modules_installed in ./
tmgmt.module - Implements hook_modules_installed().
File
- ./
tmgmt.module, line 971 - Main module file for the Translation Management module.
Code
function tmgmt_translator_auto_create($plugin) {
if ($info = tmgmt_translator_plugin_info($plugin)) {
if (!tmgmt_translator_exists($plugin)) {
$label = $info['label'] . ' (auto created)';
$translator = tmgmt_translator_create($plugin, $plugin, $label, $info['description']);
// Append some default settings from the translator plugin definition.
$translator->settings = $translator
->getController()
->defaultSettings();
$translator
->save();
}
}
}