Unverified Commit 647ad667 authored by larowlan's avatar larowlan
Browse files

Issue #2935654 by longwave, hctom: Use of undefined $languages variable in...

Issue #2935654 by longwave, hctom: Use of undefined $languages variable in NodeListBuilder::buildRow()

(cherry picked from commit e41394ec)
parent 9e0fcc41
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
use Drupal\Core\Entity\EntityListBuilder; use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Routing\RedirectDestinationInterface; use Drupal\Core\Routing\RedirectDestinationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -95,16 +94,11 @@ public function buildRow(EntityInterface $entity) { ...@@ -95,16 +94,11 @@ public function buildRow(EntityInterface $entity) {
'#theme' => 'mark', '#theme' => 'mark',
'#mark_type' => node_mark($entity->id(), $entity->getChangedTime()), '#mark_type' => node_mark($entity->id(), $entity->getChangedTime()),
]; ];
$langcode = $entity->language()->getId();
$uri = $entity->toUrl();
$options = $uri->getOptions();
$options += ($langcode != LanguageInterface::LANGCODE_NOT_SPECIFIED && isset($languages[$langcode]) ? ['language' => $languages[$langcode]] : []);
$uri->setOptions($options);
$row['title']['data'] = [ $row['title']['data'] = [
'#type' => 'link', '#type' => 'link',
'#title' => $entity->label(), '#title' => $entity->label(),
'#suffix' => ' ' . \Drupal::service('renderer')->render($mark), '#suffix' => ' ' . \Drupal::service('renderer')->render($mark),
'#url' => $uri, '#url' => $entity->toUrl(),
]; ];
$row['type'] = node_get_type_label($entity); $row['type'] = node_get_type_label($entity);
$row['author']['data'] = [ $row['author']['data'] = [
...@@ -115,7 +109,7 @@ public function buildRow(EntityInterface $entity) { ...@@ -115,7 +109,7 @@ public function buildRow(EntityInterface $entity) {
$row['changed'] = $this->dateFormatter->format($entity->getChangedTime(), 'short'); $row['changed'] = $this->dateFormatter->format($entity->getChangedTime(), 'short');
$language_manager = \Drupal::languageManager(); $language_manager = \Drupal::languageManager();
if ($language_manager->isMultilingual()) { if ($language_manager->isMultilingual()) {
$row['language_name'] = $language_manager->getLanguageName($langcode); $row['language_name'] = $language_manager->getLanguageName($entity->language()->getId());
} }
$row['operations']['data'] = $this->buildOperations($entity); $row['operations']['data'] = $this->buildOperations($entity);
return $row + parent::buildRow($entity); return $row + parent::buildRow($entity);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment