layout_builder_ipe-1.0.x-dev/tests/modules/frontend_links_test/frontend_links_test.module
tests/modules/frontend_links_test/frontend_links_test.module
<?php
/**
* @file
* Test module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
use Drupal\layout_builder\SectionStorageInterface;
/**
* Implements hook_entity_view_alter().
*/
function frontend_links_test_layout_builder_ipe_links_alter(array &$links, SectionStorageInterface $section_storage, EntityInterface $entity) {
$links['renderable'] = Link::createFromRoute(t('Frontpage'), '<front>');
$links['render_array'] = [
'#type' => 'link',
'#url' => Url::fromRoute('<front>'),
'#title' => t('Frontpage'),
];
$links['markup'] = Markup::create('<span>Markup</span>');
$links['string'] = 'Plain text';
}
