mercury_editor-2.0.x-dev/tests/modules/mercury_editor_translations_test/mercury_editor_translations_test.module
tests/modules/mercury_editor_translations_test/mercury_editor_translations_test.module
<?php
/**
* @file
* Module hooks for Mercury Editor Translations Test module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
/**
* Implements hook_entity_view_alter().
*/
function mercury_editor_translations_test_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
if ($entity->getEntityTypeId() === 'paragraph') {
$build['language_indicator'] = [
'#markup' => '<div class="me-test-paragraph-lang">Paragraph Language: ' . $entity->language()->getId() . '</div>',
'#weight' => -100,
];
$build['paragraph_id'] = [
'#markup' => '<div class="me-test-paragraph-id">Paragraph Id: ' . $entity->id() . '</div>',
'#weight' => -99,
];
}
}
