TaskEligible.php in Translation Management Tool 8
File
translators/tmgmt_local/src/Plugin/views/filter/TaskEligible.php
View source
<?php
namespace Drupal\tmgmt_local\Plugin\views\filter;
use Drupal\views\Plugin\views\filter\FilterPluginBase;
class TaskEligible extends FilterPluginBase {
public $query = NULL;
public function query() {
$this
->ensureMyTable();
$source = $this->tableAlias . '.source_language';
$target = $this->tableAlias . '.target_language';
$this->query
->setWhereGroup('OR', 'eligible');
foreach (tmgmt_local_supported_language_pairs(NULL, array(
\Drupal::currentUser()
->id(),
)) as $key => $ability) {
$key = str_replace('-', '_', $key);
$arguments = array(
':source_' . $key => $ability['source_language'],
':target_' . $key => $ability['target_language'],
);
$this->query
->addWhereExpression('eligible', "{$source} = :source_{$key} AND {$target} = :target_{$key}", $arguments);
}
}
}
Classes
Name |
Description |
TaskEligible |
Field handler which shows the link for assign translation task to user. |