You are here

public function JobItem::getSourcePlugin in Translation Management Tool 8

Returns an instance of the configured source plugin.

Return value

\Drupal\tmgmt\SourcePluginInterface

Overrides JobItemInterface::getSourcePlugin

5 calls to JobItem::getSourcePlugin()
JobItem::acceptTranslation in src/Entity/JobItem.php
Propagates the returned job item translations to the sources.
JobItem::getSourceData in src/Entity/JobItem.php
Loads the structured source data array from the source.
JobItem::getSourceLabel in src/Entity/JobItem.php
Retrieves the label of the source object via the source controller.
JobItem::getSourceType in src/Entity/JobItem.php
Returns the user readable type of job item.
JobItem::getSourceUrl in src/Entity/JobItem.php
Retrieves the path to the source object via the source controller.

File

src/Entity/JobItem.php, line 406

Class

JobItem
Entity class for the tmgmt_job_item entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getSourcePlugin() {
  if ($this
    ->get('plugin')->value) {
    try {
      return \Drupal::service('plugin.manager.tmgmt.source')
        ->createInstance($this
        ->get('plugin')->value);
    } catch (PluginException $e) {

      // Ignore exceptions due to missing source plugins.
    }
  }
  return FALSE;
}