Skip to content
Snippets Groups Projects

LanguageFormatter is not used for nodes because it's still hard coded in NodeViewBuilder

2 unresolved threads
Files
10
@@ -3,7 +3,9 @@
namespace Drupal\language\Hook;
use Drupal\Core\Access\AccessResultInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\language\EntityViewDisplayConfigUpdater;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrlFallback;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI;
@@ -30,6 +32,10 @@ class LanguageHooks {
use StringTranslationTrait;
public function __construct(
private readonly EntityViewDisplayConfigUpdater $languageConfigUpdater,
) {}
/**
* Implements hook_help().
*/
@@ -380,4 +386,14 @@ public function languageTypesInfoAlter(array &$language_types): void {
];
}
/**
* Implements hook_ENTITY_TYPE_presave().
*/
#[Hook('entity_view_display_presave')]
public function entityViewDisplayPresave(EntityViewDisplayInterface $entityViewDisplay): void {
if ($entityViewDisplay->isSyncing()) {
$this->languageConfigUpdater->updateEntityViewDisplay($entityViewDisplay);
}
}
}
Loading