Exemplo n.º 1
0
 /**
  * [@inheritdoc}
  */
 public function getType(JobItemInterface $job_item)
 {
     return $this->getItemTypeLabel($job_item->getItemType());
 }
 /**
  * The _title_callback for the page that renders a single node in preview.
  *
  * @param \Drupal\tmgmt\JobItemInterface $tmgmt_job_item
  *   The current node.
  *
  * @return string
  *   The page title.
  */
 public function title(JobItemInterface $tmgmt_job_item)
 {
     $target_language = $tmgmt_job_item->getJob()->getTargetLanguage()->getName();
     $title = $this->entityTypeManager->getStorage($tmgmt_job_item->getItemType())->load($tmgmt_job_item->getItemId())->getTitle();
     return t("Preview of @title for @target_language", ['@title' => $title, '@target_language' => $target_language]);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getType(JobItemInterface $job_item)
 {
     return ucfirst($job_item->getItemType());
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getType(JobItemInterface $job_item)
 {
     if ($job_item->getItemType() == static::SIMPLE_CONFIG) {
         $definition = $this->configMapperManager->getDefinition($job_item->getItemId());
     } else {
         $definition = $this->configMapperManager->getDefinition($job_item->getItemType());
     }
     return $definition['title'];
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getExistingLangCodes(JobItemInterface $job_item)
 {
     if ($entity = entity_load($job_item->getItemType(), $job_item->getItemId())) {
         return array_keys($entity->getTranslationLanguages());
     }
     return array();
 }
Exemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function saveTranslation(JobItemInterface $job_item, $target_langcode)
 {
     // Set a variable that can be checked later for a given job item.
     \Drupal::state()->set('tmgmt_test_saved_translation_' . $job_item->getItemType() . '_' . $job_item->getItemId(), $job_item->getData());
     return TRUE;
 }
Exemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function getData(JobItemInterface $job_item)
 {
     return array('dummy' => array('deep_nesting' => array('#text' => file_get_contents(drupal_get_path('module', 'tmgmt') . '/tests/testing_html/sample.html'), '#label' => 'Label for job item with type ' . $job_item->getItemType() . ' and id ' . $job_item->getItemId() . '.')));
 }