updated core to 7.58 (right after the site was hacked)

This commit is contained in:
2018-04-20 23:48:40 +02:00
parent 18f4aba146
commit 9344a61b61
711 changed files with 99690 additions and 480 deletions

View File

@@ -0,0 +1,38 @@
<?php
/**
* @file
* Contains the base plugin class.
*/
/**
* Base class for Translation Management plugins.
*/
class TMGMTPluginBase implements TMGMTPluginBaseInterface {
protected $pluginType;
protected $pluginInfo;
/**
* {@inheritdoc}
*/
public function __construct($type, $plugin) {
$this->pluginType = $plugin;
$this->pluginInfo = _tmgmt_plugin_info($type, $plugin);
}
/**
* {@inheritdoc}
*/
public function pluginInfo() {
return $this->pluginInfo;
}
/**
* {@inheritdoc}
*/
public function pluginType() {
return $this->pluginType;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* @file
* Contains the base plugin interface.
*/
/**
* Base interface for Translation Management plugins.
*/
interface TMGMTPluginBaseInterface {
/**
* Constructor.
*
* @param $type
* The plugin type.
* @param $plugin
* The machine-readable name of the plugin.
*/
public function __construct($type, $plugin);
/**
* Returns the info of the type of the plugin.
*
* @see tmgmt_source_plugin_info()
*/
public function pluginInfo();
/**
* Returns the type of the plugin.
*/
public function pluginType();
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* @file
* Contains the reject translator plugin interface.
*/
/**
* Handle reject on data item level.
*
* Implement this interface in a translator plugin to signal that this plugin is
* capable of handling a reject of single data items.
*
* @ingroup tmgmt_translator
*/
interface TMGMTTranslatorRejectDataItem {
/**
* Reject one single data item.
*
* @todo Using job item breaks the current convention which uses jobs.
*
* @param $job_item
* The job item to which the rejected data item belongs.
* @param $key
* The key of the rejected data item.
* The key is an array containing the keys of a nested array hierarchy path.
*
* @return
* TRUE if the reject was succesfull, else FALSE.
* In case of an error, it is the responsibility of the translator to
* provide informations about the faliure.
*/
public function rejectDataItem(TMGMTJobItem $job_item, array $key, array $values = NULL);
/**
* Reject form.
*
* This method gets call by tmgmt_ui_translation_review_form_reject_confirm
* and allows the translator to add aditional form elements in order to
* collect data needed for the reject prozess.
*
* @param $form
* The form array containing a confirm form.
* $form['item'] holds the job item to which the to be rejected data item
* belongs to.
* $form['item'] holds key of the to be rejected data item as an array of
* keys of a nested array hierarchy.
* @param $form_state
* The form state.
*
* @return
* The resulting form array.
*/
public function rejectForm($form, &$form_state);
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* @file
* Contains the source plugin interface.
*/
/**
* Interface for source plugin controllers.
*
* @ingroup tmgmt_source
*/
interface TMGMTSourcePluginControllerInterface extends TMGMTPluginBaseInterface {
/**
* Returns an array with the data structured for translation.
*
* @param TMGMTJobItem $job_item
* The job item entity.
*
* @see TMGMTJobItem::getData()
*/
public function getData(TMGMTJobItem $job_item);
/**
* Saves a translation.
*
* @param TMGMTJobItem $job_item
* The job item entity.
*
* @return boolean
* TRUE if the translation was saved successfully, FALSE otherwise.
*/
public function saveTranslation(TMGMTJobItem $job_item);
/**
* Return a title for this job item.
*
* @param TMGMTJobItem $job_item
* The job item entity.
*/
public function getLabel(TMGMTJobItem $job_item);
/**
* Returns the Uri for this job item.
*
* @param TMGMTJobItem $job_item
* The job item entity.
*
* @see entity_uri()
*/
public function getUri(TMGMTJobItem $job_item);
/**
* Returns an array of translatable source item types.
*/
public function getItemTypes();
/**
* Returns the label of a source item type.
*
* @param $type
* The identifier of a source item type.
*/
public function getItemTypeLabel($type);
/**
* Returns the type of a job item.
*
* @param TMGMTJobItem $job_item
* The job item.
*
* @return string
* A type that describes the job item.
*/
public function getType(TMGMTJobItem $job_item);
/**
* Gets language code of the job item source.
*
* @param TMGMTJobItem $job_item
* The job item.
*
* @return string
* Language code.
*/
public function getSourceLangCode(TMGMTJobItem $job_item);
/**
* Gets existing translation language codes of the job item source.
*
* Returns language codes that can be used as the source language for a
* translation job.
*
* @param TMGMTJobItem $job_item
* The job item.
*
* @return array
* Array of language codes.
*/
public function getExistingLangCodes(TMGMTJobItem $job_item);
}

View File

@@ -0,0 +1,258 @@
<?php
/**
* @file
* Contains the source plugin interface.
*/
/**
* Interface for service plugin controllers.
*
* @ingroup tmgmt_translator
*/
interface TMGMTTranslatorPluginControllerInterface extends TMGMTPluginBaseInterface {
/**
* Checks whether a translator is available.
*
* @param TMGMTTranslator $translator
* The translator entity.
*
* @return boolean
* TRUE if the translator plugin is available, FALSE otherwise.
*/
public function isAvailable(TMGMTTranslator $translator);
/**
* Return a reason why the translator is not available.
*
* @param TMGMTTranslator $translator
* The translator entity.
*
* Might be called when isAvailable() returns FALSE to get a reason that
* can be displayed to the user.
*
* @todo Remove this once http://drupal.org/node/1420364 is done.
*/
public function getNotAvailableReason(TMGMTTranslator $translator);
/**
* Check whether this service can handle a particular translation job.
*
* @param TMGMTTranslator $translator
* The TMGMTTranslator entity that should handle the translation.
* @param TMGMTJob $job
* The TMGMTJob entity that should be translated.
*
* @return boolean
* TRUE if the job can be processed and translated, FALSE otherwise.
*/
public function canTranslate(TMGMTTranslator $translator, TMGMTJob $job);
/**
* Return a reason why the translator is not able to translate this job.
*
* @param TMGMTJob $job
* The job entity.
*
* Might be called when canTranslate() returns FALSE to get a reason that
* can be displayed to the user.
*
* @todo Remove this once http://drupal.org/node/1420364 is done.
*/
public function getNotCanTranslateReason(TMGMTJob $job);
/**
* Specifies default mappings for local to remote language codes.
*
* This method can be used in case we know in advance what language codes are
* used by the remote translator and to which local language codes they
* correspond.
*
* @return array
* An array of local => remote language codes.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function getDefaultRemoteLanguagesMappings();
/**
* Gets all supported languages of the translator.
*
* This list of all language codes used by the remote translator is then used
* for example in the translator settings form to select which remote language
* code correspond to which local language code.
*
* @param TMGMTTranslator $translator
* Translator entity for which to get supported languages.
*
* @return array
* An array of language codes which are provided by the translator
* (remote language codes).
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function getSupportedRemoteLanguages(TMGMTTranslator $translator);
/**
* Gets existing remote languages mappings.
*
* This method is responsible to provide all local to remote language pairs.
*
* @param TMGMTTranslator $translator
* Translator entity for which to get mappings.
*
* @return array
* An array of local => remote language codes.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function getRemoteLanguagesMappings(TMGMTTranslator $translator);
/**
* Maps local language to remote language.
*
* @param TMGMTTranslator $translator
* Translator entity for which to get remote language.
* @param $language
* Local language code.
*
* @return string
* Remote language code.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function mapToRemoteLanguage(TMGMTTranslator $translator, $language);
/**
* Maps remote language to local language.
*
* @param TMGMTTranslator $translator
* Translator entity for which to get local language.
* @param $language
* Remote language code.
*
* @return string
* Local language code.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function mapToLocalLanguage(TMGMTTranslator $translator, $language);
/**
* Returns all available target languages that are supported by this service
* when given a source language.
*
* @param TMGMTTranslator $translator
* The translator entity.
* @param $source_language
* The source language.
*
* @return array
* An array of remote languages in ISO format.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function getSupportedTargetLanguages(TMGMTTranslator $translator, $source_language);
/**
* Returns supported language pairs.
*
* This info may be used by other plugins to find out what language pairs
* can handle the translator.
*
* @param TMGMTTranslator $translator
* The translator entity.
*
* @return array
* List of language pairs where a pair is an associative array of
* source_language and target_language.
* Example:
* array(
* array('source_language' => 'en-US', 'target_language' => 'de-DE'),
* array('source_language' => 'en-US', 'target_language' => 'de-CH'),
* )
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function getSupportedLanguagePairs(TMGMTTranslator $translator);
/**
* @abstract
*
* Submits the translation request and sends it to the translation provider.
*
* @param TMGMTJob $job
* The job that should be submitted.
*
* @ingroup tmgmt_remote_languages_mapping
*/
public function requestTranslation(TMGMTJob $job);
/**
* Aborts a translation job.
*
* @param TMGMTJob $job
* The job that should have its translation aborted.
*
* @return boolean
* TRUE if the job could be aborted, FALSE otherwise.
*/
public function abortTranslation(TMGMTJob $job);
/**
* Defines default settings.
*
* @return array
* An array of default settings.
*/
public function defaultSettings();
/**
* Returns if the translator has any settings for the passed job.
*/
public function hasCheckoutSettings(TMGMTJob $job);
/**
* Accept a single data item.
*
* @todo Using job item breaks the current convention which uses jobs.
*
* @param $job_item
* The Job item the accepted data item belongs to.
* @param $key
* The key of the accepted data item.
* The key is an array containing the keys of a nested array hierarchy path.
*
* @return
* TRUE if the approving was succesfull, FALSE otherwise.
* In case of an error, it is the responsibility of the translator to
* provide informations about the failure by adding a message to the job
* item.
*/
public function acceptetDataItem(TMGMTJobItem $job_item, array $key);
/**
* Returns the escaped #text of a data item.
*
* @param array $data_item
* A data item with a #text and optional #escape definitions.
*
* @return string
* The text of the data item with translator-specific escape patterns
* applied.
*/
public function escapeText(array $data_item);
/**
* Removes escape patterns from an escaped text.
*
* @param string $text
* The text from which escape patterns should be removed.
*
* @return string
* The unescaped text.
*/
public function unescapeText($text);
}

View File

@@ -0,0 +1,64 @@
<?php
/**
* @file
* Contains the abstract source base plugin class.
*/
/**
* Default controller class for source plugins.
*
* @ingroup tmgmt_source
*/
abstract class TMGMTDefaultSourcePluginController extends TMGMTPluginBase implements TMGMTSourcePluginControllerInterface {
/**
* {@inheritdoc}
*/
public function getLabel(TMGMTJobItem $job_item) {
return t('@plugin item unavailable (@item)', array('@plugin' => $this->pluginInfo['label'], '@item' => $job_item->item_type . ':' . $job_item->item_id));
}
/**
* {@inheritdoc}
*/
public function getUri(TMGMTJobItem $job_item) {
return array(
'path' => '',
'options' => array(),
);
}
/**
* {@inheritdoc}
*/
public function getItemTypes() {
return isset($this->pluginInfo['item types']) ? $this->pluginInfo['item types'] : array();
}
/**
* {@inheritdoc}
*/
public function getItemTypeLabel($type) {
$types = $this->getItemTypes();
if (isset($types[$type])) {
return $types[$type];
}
return '';
}
/**
* {@inheritdoc}
*/
public function getType(TMGMTJobItem $job_item) {
return ucfirst($job_item->item_type);
}
/**
* {@inheritdoc}
*/
public function getExistingLangCodes(TMGMTJobItem $job_item) {
return array();
}
}

View File

@@ -0,0 +1,246 @@
<?php
/**
* @file
* Contains the abstract translator base plugin class.
*/
/**
* Default controller class for service plugins.
*
* @ingroup tmgmt_translator
*/
abstract class TMGMTDefaultTranslatorPluginController extends TMGMTPluginBase implements TMGMTTranslatorPluginControllerInterface {
protected $supportedRemoteLanguages = array();
protected $remoteLanguagesMappings = array();
/**
* Characters that indicate the beginning of an escaped string.
*
* @var string
*/
protected $escapeStart = '';
/**
* Characters that indicate the end of an escaped string.
*
* @var string
*/
protected $escapeEnd = '';
/**
* {@inheritdoc}
*/
public function isAvailable(TMGMTTranslator $translator) {
// Assume that the translation service is always available.
return TRUE;
}
/**
* {@inheritdoc}
*/
public function canTranslate(TMGMTTranslator $translator, TMGMTJob $job) {
// The job is only translatable if the translator is available too.
if ($this->isAvailable($translator) && array_key_exists($job->target_language, $translator->getSupportedTargetLanguages($job->source_language))) {
// We can only translate this job if the target language of the job is in
// one of the supported languages.
return TRUE;
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function abortTranslation(TMGMTJob $job) {
// Assume that we can abort a translation job at any time.
$job->aborted();
return TRUE;
}
/**
* {@inheritdoc}
*/
public function getDefaultRemoteLanguagesMappings() {
return array();
}
/**
* {@inheritdoc}
*/
public function getSupportedRemoteLanguages(TMGMTTranslator $translator) {
return array();
}
/**
* {@inheritdoc}
*/
public function getRemoteLanguagesMappings(TMGMTTranslator $translator) {
if (!empty($this->remoteLanguagesMappings)) {
return $this->remoteLanguagesMappings;
}
foreach (language_list() as $language => $info) {
$this->remoteLanguagesMappings[$language] = $this->mapToRemoteLanguage($translator, $language);
}
return $this->remoteLanguagesMappings;
}
/**
* {@inheritdoc}
*/
public function mapToRemoteLanguage(TMGMTTranslator $translator, $language) {
if (!tmgmt_provide_remote_languages_mappings($translator)) {
return $language;
}
if (!empty($translator->settings['remote_languages_mappings'][$language])) {
return $translator->settings['remote_languages_mappings'][$language];
}
$default_mappings = $this->getDefaultRemoteLanguagesMappings();
if (isset($default_mappings[$language])) {
return $default_mappings[$language];
}
return $language;
}
/**
* {@inheritdoc}
*/
public function mapToLocalLanguage(TMGMTTranslator $translator, $language) {
if (!tmgmt_provide_remote_languages_mappings($translator)) {
return $language;
}
if (isset($translator->settings['remote_languages_mappings']) && is_array($translator->settings['remote_languages_mappings'])) {
$mappings = $translator->settings['remote_languages_mappings'];
}
else {
$mappings = $this->getDefaultRemoteLanguagesMappings();
}
if ($remote_language = array_search($language, $mappings)) {
return $remote_language;
}
return $language;
}
/**
* {@inheritdoc}
*/
public function getSupportedTargetLanguages(TMGMTTranslator $translator, $source_language) {
$languages = entity_metadata_language_list();
unset($languages[LANGUAGE_NONE], $languages[$source_language]);
return drupal_map_assoc(array_keys($languages));
}
/**
* {@inheritdoc}
*
* Default implementation that gets target languages for each remote language.
* This approach is ineffective and therefore it is advised that a plugin
* should provide own implementation.
*/
public function getSupportedLanguagePairs(TMGMTTranslator $translator) {
$language_pairs = array();
foreach ($this->getSupportedRemoteLanguages($translator) as $source_language) {
foreach ($this->getSupportedTargetLanguages($translator, $source_language) as $target_language) {
$language_pairs[] = array('source_language' => $source_language, 'target_language' => $target_language);
}
}
return $language_pairs;
}
/**
* {@inheritdoc}
*/
public function getNotCanTranslateReason(TMGMTJob $job) {
$wrapper = entity_metadata_wrapper('tmgmt_job', $job);
return t('@translator can not translate from @source to @target.', array('@translator' => $job->getTranslator()->label(), '@source' => $wrapper->source_language->label(), '@target' => $wrapper->target_language->label()));
}
/**
* {@inheritdoc}
*/
public function getNotAvailableReason(TMGMTTranslator $translator) {
return t('@translator is not available. Make sure it is properly !configured.', array('@translator' => $this->pluginInfo['label'], '!configured' => l(t('configured'), 'admin/config/regional/tmgmt_translator/manage/' . $translator->name)));
}
/**
* {@inheritdoc}
*/
public function defaultSettings() {
$defaults = array('auto_accept' => FALSE);
// Check if any default settings are defined in the plugin info.
if (isset($this->pluginInfo['default settings'])) {
return array_merge($defaults, $this->pluginInfo['default settings']);
}
return $defaults;
}
/**
* {@inheritdoc}
*/
public function hasCheckoutSettings(TMGMTJob $job) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function acceptetDataItem(TMGMTJobItem $job_item, array $key) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function escapeText(array $data_item) {
if (empty($data_item['#escape'])) {
return $data_item['#text'];
}
$text = $data_item['#text'];
$escape = $data_item['#escape'];
// Sort them in reverse order based/ on the position and process them,
// so that positions don't change.
krsort($escape, SORT_NUMERIC);
foreach ($escape as $position => $info) {
$text = substr_replace($text, $this->getEscapedString($info['string']), $position, strlen($info['string']));
}
return $text;
}
/**
* Returns the escaped string.
*
* Defaults to use the escapeStart and escapeEnd properties but can be
* overriden if a non-static replacement pattern is used.
*
* @param string $string
* String that should be escaped.
* @return string
*/
protected function getEscapedString($string) {
return $this->escapeStart . $string . $this->escapeEnd;
}
/**
* {@inheritdoc}
*/
public function unescapeText($text) {
return preg_replace('/' . preg_quote($this->escapeStart, '/') . '(.+)' . preg_quote($this->escapeEnd, '/') . '/U', '$1', $text);
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* Interface for source ui controllers.
*
* @ingroup tmgmt_source
*/
interface TMGMTSourceUIControllerInterface extends TMGMTPluginBaseInterface {
/**
* Form callback for the job item review form.
*/
public function reviewForm($form, &$form_state, TMGMTJobItem $item);
/**
* Form callback for the data item element form.
*/
public function reviewDataItemElement($form, &$form_state, $data_item_key, $parent_key, array $data_item, TMGMTJobItem $item);
/**
* Validation callback for the job item review form.
*/
public function reviewFormValidate($form, &$form_state, TMGMTJobItem $item);
/**
* Submit callback for the job item review form.
*/
public function reviewFormSubmit($form, &$form_state, TMGMTJobItem $item);
/**
* {@inheritdoc}
*
* @see tmgmt_ui_menu().
*/
public function hook_menu();
/**
* {@inheritdoc}
*
* @see tmgmt_ui_forms().
*/
public function hook_forms();
/**
* {@inheritdoc}
*
* @see tmgmt_ui_views_default_views().
*/
public function hook_views_default_views();
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Interface for translator ui controllers.
*
* @ingroup tmgmt_translator
*/
interface TMGMTTranslatorUIControllerInterface extends TMGMTPluginBaseInterface {
/**
* Form callback for the plugin settings form.
*/
public function pluginSettingsForm($form, &$form_state, TMGMTTranslator $translator, $busy = FALSE);
/**
* Form callback for the checkout settings form.
*/
public function checkoutSettingsForm($form, &$form_state, TMGMTJob $job);
/**
* Retrieves information about a translation job.
*
* Services based translators with remote states should place a Poll button
* here to sync the job state.
*
* @param TMGMTJob $job
* The translation job.
*/
public function checkoutInfo(TMGMTJob $job);
/**
* Form callback for the job item review form.
*/
public function reviewForm($form, &$form_state, TMGMTJobItem $item);
/**
* Form callback for the data item element form.
*/
public function reviewDataItemElement($form, &$form_state, $data_item_key, $parent_key, array $data_item, TMGMTJobItem $item);
/**
* Validation callback for the job item review form.
*/
public function reviewFormValidate($form, &$form_state, TMGMTJobItem $item);
/**
* Submit callback for the job item review form.
*/
public function reviewFormSubmit($form, &$form_state, TMGMTJobItem $item);
}

View File

@@ -0,0 +1,111 @@
<?php
/**
* Default ui controller class for source plugin.
*
* @ingroup tmgmt_source
*/
class TMGMTDefaultSourceUIController extends TMGMTPluginBase implements TMGMTSourceUIControllerInterface {
/**
* {@inheritdoc}
*/
public function reviewForm($form, &$form_state, TMGMTJobItem $item) {
return $form;
}
/**
* {@inheritdoc}
*/
public function reviewDataItemElement($form, &$form_state, $data_item_key, $parent_key, array $data_item, TMGMTJobItem $item) {
return $form;
}
/**
* {@inheritdoc}
*/
public function reviewFormValidate($form, &$form_state, TMGMTJobItem $item) {
// Nothing to do here by default.
}
/**
* {@inheritdoc}
*/
public function reviewFormSubmit($form, &$form_state, TMGMTJobItem $item) {
// Nothing to do here by default.
}
/**
* {@inheritdoc}
*/
public function overviewForm($form, &$form_state, $type) {
return $form;
}
/**
* {@inheritdoc}
*/
public function overviewFormValidate($form, &$form_state, $type) {
// Nothing to do here by default.
}
/**
* {@inheritdoc}
*/
public function overviewFormSubmit($form, &$form_state, $type) {
// Nothing to do here by default.
}
/**
* {@inheritdoc}
*/
public function hook_menu() {
$items = array();
if ($types = tmgmt_source_translatable_item_types($this->pluginType)) {
$defaults = array(
'page callback' => 'drupal_get_form',
'access callback' => 'tmgmt_job_access',
'access arguments' => array('create'),
);
if (isset($this->pluginInfo['file'])) {
$defaults['file'] = $this->pluginInfo['file'];
}
if (isset($this->pluginInfo['file path'])) {
$defaults['file path'] = $this->pluginInfo['file path'];
}
foreach ($types as $type => $name) {
$items['admin/tmgmt/sources/' . $this->pluginType . '_' . $type] = $defaults + array(
'title' => check_plain($name),
'page arguments' => array('tmgmt_ui_' . $this->pluginType . '_source_' . $type . '_overview_form', $this->pluginType, $type),
'type' => MENU_LOCAL_TASK,
);
}
}
return $items;
}
/**
* {@inheritdoc}
*/
public function hook_forms() {
$info = array();
if ($types = tmgmt_source_translatable_item_types($this->pluginType)) {
foreach (array_keys($types) as $type) {
$info['tmgmt_ui_' . $this->pluginType . '_source_' . $type . '_overview_form'] = array(
'callback' => 'tmgmt_ui_source_overview_form',
'wrapper_callback' => 'tmgmt_ui_source_overview_form_defaults',
);
}
}
return $info;
}
/**
* {@inheritdoc}
*/
public function hook_views_default_views() {
return array();
}
}

View File

@@ -0,0 +1,128 @@
<?php
/**
* Default ui controller class for translator plugins.
*
* @ingroup tmgmt_translator
*/
class TMGMTDefaultTranslatorUIController extends TMGMTPluginBase implements TMGMTTranslatorUIControllerInterface {
/**
* {@inheritdoc}
*/
public function pluginSettingsForm($form, &$form_state, TMGMTTranslator $translator, $busy = FALSE) {
if (!empty($translator->plugin)) {
$controller = tmgmt_translator_plugin_controller($translator->plugin);
}
// If current translator is configured to provide remote language mapping
// provide the form to configure mappings, unless it does not exists yet.
if (!empty($controller) && tmgmt_provide_remote_languages_mappings($translator)) {
$form['remote_languages_mappings'] = array(
'#tree' => TRUE,
'#type' => 'fieldset',
'#title' => t('Remote languages mappings'),
'#description' => t('Here you can specify mappings of your local language codes to the translator language codes.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$options = array();
foreach ($controller->getSupportedRemoteLanguages($translator) as $language) {
$options[$language] = $language;
}
ksort($options);
foreach ($controller->getRemoteLanguagesMappings($translator) as $local_language => $remote_language) {
$form['remote_languages_mappings'][$local_language] = array(
'#type' => 'textfield',
'#title' => tmgmt_language_label($local_language) . ' (' . $local_language . ')',
'#default_value' => $remote_language,
'#size' => 6,
);
if (!empty($options)) {
$form['remote_languages_mappings'][$local_language]['#type'] = 'select';
$form['remote_languages_mappings'][$local_language]['#options'] = $options;
$form['remote_languages_mappings'][$local_language]['#empty_option'] = ' - ';
unset($form['remote_languages_mappings'][$local_language]['#size']);
}
}
}
if (!element_children($form)) {
$form['#description'] = t("The @plugin plugin doesn't provide any settings.", array('@plugin' => $this->pluginInfo['label']));
}
return $form;
}
/**
* {@inheritdoc}
*/
public function checkoutSettingsForm($form, &$form_state, TMGMTJob $job) {
if (!element_children($form)) {
$form['#description'] = t("The @translator translator doesn't provide any checkout settings.", array('@translator' => $job->getTranslator()->label()));
}
return $form;
}
/**
* {@inheritdoc}
*/
public function checkoutInfo(TMGMTJob $job) {
return array();
}
/**
* Provides a simple wrapper for the checkout info fieldset.
*
* @param TMGMTJob $job
* Translation job object.
* @param $form
* Partial form structure to be wrapped in the fieldset.
*
* @return
* The provided form structure wrapped in a collapsed fieldset.
*/
public function checkoutInfoWrapper(TMGMTJob $job, $form) {
$label = $job->getTranslator()->label();
$form += array(
'#title' => t('@translator translation job information', array('@translator' => $label)),
'#type' => 'fieldset',
'#collapsible' => TRUE,
);
return $form;
}
/**
* {@inheritdoc}
*/
public function reviewForm($form, &$form_state, TMGMTJobItem $item) {
return $form;
}
/**
* {@inheritdoc}
*/
public function reviewDataItemElement($form, &$form_state, $data_item_key, $parent_key, array $data_item, TMGMTJobItem $item) {
return $form;
}
/**
* {@inheritdoc}
*/
public function reviewFormValidate($form, &$form_state, TMGMTJobItem $item) {
// Nothing to do here by default.
}
/**
* {@inheritdoc}
*/
public function reviewFormSubmit($form, &$form_state, TMGMTJobItem $item) {
// Nothing to do here by default.
}
}