Для получения полного доступа
зарегистрируйтесь.

SilverFire    3   3,348


It seems user decided to remain silent about himself.
  • Kyiv
  • Yii framework, HiQDev
  • Registered 4 years ago
Профиль завершён на 20 %
20 %

The function above checks, whether the current controller's action is the same as defined in the defaultRoute property of application.

function isHomePage() {
  $actualRoute = Yii::$app->controller->getRoute();

  list($controller, $actionId) = Yii::$app->createController('');
  $actionId = !empty($actionId) ? $actionId : $controller->defaultAction;
  $defaultRoute = $controller->getUniqueId() . '/' . $actionId;

  return $actualRoute === $defaultRoute;
}