|
@@ -71,6 +71,9 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
|
|
$desktop_domain = $domain_storage->load('encyclopediedelaparole_org');
|
|
|
// dpm($desktop_domain, 'desktop_domain');
|
|
|
|
|
|
+ $expo_domain = $domain_storage->load('expo_encyclopediedelaparole_org');
|
|
|
+ // dpm($expo_domain, 'expo_domain');
|
|
|
+
|
|
|
$current_domain = $domain_storage->loadByHostname($current_hostname);
|
|
|
// dpm($current_domain, 'current_domain');
|
|
|
|
|
@@ -79,6 +82,7 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
|
|
$is_mobile_domain = ($current_domain->id() == $mobile_domain->id());
|
|
|
$mobile_url = $mobile_domain->getHostname();
|
|
|
$desktop_url = $desktop_domain->getHostname();
|
|
|
+ $expo_url = $expo_domain->getHostname();
|
|
|
}else{
|
|
|
// we are not in a main domain, so we look for an alias
|
|
|
$domain_alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
|
|
@@ -93,34 +97,30 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
|
|
$env_aliases = $domain_alias_storage->loadByEnvironment($env);
|
|
|
// dpm($env_aliases, '$env_aliases');
|
|
|
// find out mibile alias and desktop alias
|
|
|
- // this is dirty
|
|
|
+ // get mobile pattern
|
|
|
+ foreach ($env_aliases as $env_alias_id => $env_alias) {
|
|
|
+ switch ($env_alias->getDomainId()) {
|
|
|
+ case 'm_encyclopediedelaparole_org':
|
|
|
+ $mobile_url = $env_alias->getPattern();
|
|
|
+ break;
|
|
|
+ case 'encyclopediedelaparole_org':
|
|
|
+ $desktop_url = $env_alias->getPattern();
|
|
|
+ break;
|
|
|
+ case 'expo_encyclopediedelaparole_org':
|
|
|
+ $expo_url = $env_alias->getPattern();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
// TODO: set target device as domain setting
|
|
|
if ($domain_id == 'm_encyclopediedelaparole_org'){
|
|
|
// current domain/alias is mobile
|
|
|
$is_mobile_domain = true;
|
|
|
- $mobile_url = $alias->getPattern();
|
|
|
- // find desktop pattern
|
|
|
- // we assume that there is only two alias by env (mobile or desktop)
|
|
|
- foreach ($env_aliases as $env_alias_id => $env_alias) {
|
|
|
- if($env_alias_id != $alias->id()){
|
|
|
- // we found the desktop pattern
|
|
|
- $desktop_url = $env_alias->getPattern();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ }elseif($domain_id == 'expo_encyclopediedelaparole_org'){
|
|
|
+ // current domain/alias is expo
|
|
|
+ $is_mobile_domain = false;
|
|
|
}else{
|
|
|
// current domain/alias is desktop
|
|
|
$is_mobile_domain = false;
|
|
|
- $desktop_url = $alias->getPattern();
|
|
|
- // find mobile pattern
|
|
|
- // we assume that there is only two alias by env (mobile or desktop)
|
|
|
- foreach ($env_aliases as $env_alias_id => $env_alias) {
|
|
|
- if($env_alias_id != $alias->id()){
|
|
|
- // we found the mobile pattern
|
|
|
- $mobile_url = $env_alias->getPattern();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -135,6 +135,8 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
|
|
// $desktop_home_path = "???";
|
|
|
$desktop_home_path = \Drupal::config('domain_site_settings.domainconfigsettings')->get('encyclopediedelaparole_org.site_frontpage', FALSE);
|
|
|
|
|
|
+ $expo_home_path = \Drupal::config('domain_site_settings.domainconfigsettings')->get('expo_encyclopediedelaparole_org.site_frontpage', FALSE);
|
|
|
+
|
|
|
// $redirect = false;
|
|
|
$js_str = "var edlp_mobile = {\n
|
|
|
current_url:'".$base_root."',\n
|
|
@@ -146,6 +148,8 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
|
|
mobile_home_path:'".$mobile_home_path."',\n
|
|
|
desktop_url:'".$desktop_url."',\n
|
|
|
desktop_home_path:'".$desktop_home_path."',\n
|
|
|
+ expo_url:'".$expo_url."',\n
|
|
|
+ expo_home_path:'".$expo_home_path."',\n
|
|
|
};";
|
|
|
|
|
|
$attachments['#attached']['html_head'][] = [
|