class TMGMTLocalTranslatorUIController in Translation Management Tool 7
Local translator plugin UI controller.
Hierarchy
- class \TMGMTPluginBase implements TMGMTPluginBaseInterface
- class \TMGMTDefaultTranslatorUIController implements TMGMTTranslatorUIControllerInterface
Expanded class hierarchy of TMGMTLocalTranslatorUIController
1 string reference to 'TMGMTLocalTranslatorUIController'
- tmgmt_local_tmgmt_translator_plugin_info in translators/
tmgmt_local/ tmgmt_local.module - Implements hook_tmgmt_translator_plugin_info().
File
- translators/
tmgmt_local/ includes/ tmgmt_local.plugin.ui.inc, line 11 - Provides the user translator UI plugin controller.
View source
class TMGMTLocalTranslatorUIController extends TMGMTDefaultTranslatorUIController {
/**
* {@inheritdoc}
*/
public function checkoutSettingsForm($form, &$form_state, TMGMTJob $job) {
if ($translators = tmgmt_local_translators($job->source_language, array(
$job->target_language,
))) {
$form['translator'] = array(
'#title' => t('Select translator for this job'),
'#type' => 'select',
'#options' => array(
'' => t('Select user'),
) + $translators,
'#default_value' => $job
->getSetting('translator'),
);
}
else {
$form['message'] = array(
'#markup' => t('There are no translators available.'),
);
}
return $form;
}
/**
* {@inheritdoc}
*/
public function checkoutInfo(TMGMTJob $job) {
$label = $job
->getTranslator()
->label();
$form['#title'] = t('@translator translation job information', array(
'@translator' => $label,
));
$form['#type'] = 'fieldset';
$tuid = $job
->getSetting('translator');
if ($tuid && ($translator = user_load($tuid))) {
$form['job_status'] = array(
'#type' => 'item',
'#title' => t('Job status'),
'#markup' => t('Translation job is assigned to %name.', array(
'%name' => entity_label('user', $translator),
)),
);
}
else {
$form['job_status'] = array(
'#type' => 'item',
'#title' => t('Job status'),
'#markup' => t('Translation job is not assigned to any translator.'),
);
}
if ($job
->getSetting('job_comment')) {
$form['job_comment'] = array(
'#type' => 'item',
'#title' => t('Job comment'),
'#markup' => filter_xss($job
->getSetting('job_comment')),
);
}
return $form;
}
public function pluginSettingsForm($form, &$form_state, TMGMTTranslator $translator, $busy = FALSE) {
$form['allow_all'] = array(
'#title' => t('Allow translations for enabled languages even if no translator has the necessary capabilities'),
'#type' => 'checkbox',
'#default_value' => $translator
->getSetting('allow_all'),
);
return $form;
}
}