You are here

interface SourcePluginInterface in Translation Management Tool 8

Interface for source plugin controllers.

Hierarchy

Expanded class hierarchy of SourcePluginInterface

All classes that implement SourcePluginInterface

Related topics

File

src/SourcePluginInterface.php, line 12

Namespace

Drupal\tmgmt
View source
interface SourcePluginInterface extends PluginInspectionInterface {

  /**
   * Returns an array with the data structured for translation.
   *
   * @param \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item entity.
   *
   * @see JobItem::getData()
   */
  public function getData(JobItemInterface $job_item);

  /**
   * Saves a translation.
   *
   * @param \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item entity.
   * @param string $target_langcode
   *   The target language code.
   *
   * @return bool
   *   TRUE if the translation was saved successfully, FALSE otherwise.
   */
  public function saveTranslation(JobItemInterface $job_item, $target_langcode);

  /**
   * Return a title for this job item.
   *
   * @param \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item entity.
   */
  public function getLabel(JobItemInterface $job_item);

  /**
   * Returns the Uri for this job item.
   *
   * @param \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item entity.
   *
   * @return \Drupal\Core\Url|null
   *   The URL object for the source object.
   */
  public function getUrl(JobItemInterface $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 \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item.
   *
   * @return string
   *   A type that describes the job item.
   */
  public function getType(JobItemInterface $job_item);

  /**
   * Gets language code of the job item source.
   *
   * @param \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item.
   *
   * @return string
   *   Language code.
   */
  public function getSourceLangCode(JobItemInterface $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 \Drupal\tmgmt\JobItemInterface $job_item
   *   The job item.
   *
   * @return array
   *   Array of language codes.
   */
  public function getExistingLangCodes(JobItemInterface $job_item);

}

Members

Namesort descending Modifiers Type Description Overrides
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
SourcePluginInterface::getData public function Returns an array with the data structured for translation. 4
SourcePluginInterface::getExistingLangCodes public function Gets existing translation language codes of the job item source. 1
SourcePluginInterface::getItemTypeLabel public function Returns the label of a source item type. 1
SourcePluginInterface::getItemTypes public function Returns an array of translatable source item types. 1
SourcePluginInterface::getLabel public function Return a title for this job item. 1
SourcePluginInterface::getSourceLangCode public function Gets language code of the job item source. 4
SourcePluginInterface::getType public function Returns the type of a job item. 1
SourcePluginInterface::getUrl public function Returns the Uri for this job item. 1
SourcePluginInterface::saveTranslation public function Saves a translation. 4