drupal 8 link render array
$url = Url::fromRoute('entity.node.edit_form', array('node' => NID));
$link = [
'#type' => 'link',
'#url' => $url,
'#title' => t('This link was rendered')
];
4.43
7
use Drupal\Core\Url;
$rendable_link = [
'#type' => 'link',
'#title' => $this->t('Link title'),
'#url' => Url::fromRoute('YOUR_ROUTE'),
];
Thank you!
7
0
Are there any code examples left?
New code examples in category Javascript