SourcePluginBase.php in Translation Management Tool 8
File
src/SourcePluginBase.php
View source
<?php
namespace Drupal\tmgmt;
use Drupal\Core\Plugin\PluginBase;
abstract class SourcePluginBase extends PluginBase implements SourcePluginInterface {
public function getLabel(JobItemInterface $job_item) {
return t('@plugin item unavailable (@item)', array(
'@plugin' => $this->pluginDefinition['label'],
'@item' => $job_item
->getItemType() . ':' . $job_item
->getItemId(),
));
}
public function getUrl(JobItemInterface $job_item) {
return NULL;
}
public function getItemTypes() {
return isset($this->pluginDefinition['item types']) ? $this->pluginDefinition['item types'] : array();
}
public function getItemTypeLabel($type) {
$types = $this
->getItemTypes();
if (isset($types[$type])) {
return $types[$type];
}
return '';
}
public function getType(JobItemInterface $job_item) {
return ucfirst($job_item
->getItemType());
}
public function getExistingLangCodes(JobItemInterface $job_item) {
return [
$this
->getSourceLangCode($job_item),
];
}
}