/** * @param View $view * @param mixed $entity * * @return string */ public static function generateViewReferenceId(View $view, $entity = null) { $id = $view->getId(); if ($view instanceof BusinessPage) { $id = $view->getTemplate()->getId(); $entity = $view->getBusinessEntity(); } elseif (!$view instanceof WebViewInterface) { return $view->getId(); } $refId = sprintf('ref_%s', $id); if ($entity) { $refId .= '_' . $entity->getId(); } if ($view->getCurrentLocale() != '') { $refId .= '_' . $view->getCurrentLocale(); } return $refId; }