public function FlippyPager::flippy_generate_link in DXPR Theme Helper 8
Helper function to generate link.
Parameters
$nodeId: Target node ID.
$label: Target node label.
Return value
array|\mixed[] Link render array.
File
- src/
FlippyPager.php, line 238
Class
- FlippyPager
- Defines the flippy pager service.
Namespace
Drupal\glazed_helperCode
public function flippy_generate_link($nodeId, $label) {
$language = $this->languageManager
->getCurrentLanguage()
->getId();
$url = Url::fromRoute('entity.node.canonical');
$url
->setRouteParameter('node', $nodeId);
$url
->setOptions([
'attributes' => [
'class' => [
'nextprev-link',
],
],
]);
$flippyLink = Link::fromTextAndUrl($label, $url);
return $flippyLink
->toRenderable();
}