diff --git a/src/Service/UWService.php b/src/Service/UWService.php index 362e36d142a7392ee06ea4bede710087997afe4f..e9369108e62939a6034287d757a9eb1db4292319 100644 --- a/src/Service/UWService.php +++ b/src/Service/UWService.php @@ -368,4 +368,19 @@ class UWService implements UWServiceInterface { } } + /** + * Determine whether a node is the home page. + * + * @param int $nid + * A node ID. + * + * @return bool + * TRUE when the node is the home page, FALSE otherwise. + */ + public static function nodeIsHomePage(int $nid): bool { + $front_page_path = \Drupal::configFactory()->get('system.site')->get('page.front'); + $node_alias = \Drupal::service('path_alias.manager')->getAliasByPath('/node/' . $nid); + return $front_page_path === $node_alias; + } + }