new mobile home #423
This commit is contained in:
@@ -22,12 +22,50 @@ function edlp_home_theme($existing, $type, $theme, $path) {
|
||||
// 'presentation_node' => NULL,
|
||||
// 'last_fil_node' => NULL,
|
||||
// 'last_production_node' => NULL,
|
||||
'promoted_nodes' => array(),
|
||||
'promoted_statics' => array(),
|
||||
'promoted_prods' => array(),
|
||||
'lastdocs_items' => NULL,
|
||||
'agenda_items' => NULL,
|
||||
// 'entrees_items' => NULL,
|
||||
'collection_link' => NULL,
|
||||
'production_link' => NULL,
|
||||
'agenda_link' => NULL,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme_suggestions_HOOK().
|
||||
*/
|
||||
function edlp_home_theme_suggestions_edlp_home_alter(array &$suggestions, array $variables) {
|
||||
$is_mobile_domain = false;
|
||||
|
||||
// get domains from domain module
|
||||
$domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
|
||||
$mobile_domain_id = 'm_encyclopediedelaparole_org';
|
||||
// $mobile_domain = $domain_storage->load('m_encyclopediedelaparole_org');
|
||||
global $base_root;
|
||||
// get the current hostname (domain)
|
||||
$current_hostname = preg_replace('/http:\/\/|https:\/\//i', '', $base_root);
|
||||
// get the current domain
|
||||
$current_domain = $domain_storage->loadByHostname($current_hostname);
|
||||
|
||||
if($current_domain){
|
||||
// we are in a main domain
|
||||
// $is_mobile_domain = ($current_domain->id() == $mobile_domain_id);
|
||||
$current_domain_id = $current_domain->id();
|
||||
}else{
|
||||
// we are not in a main domain, so we look for an alias
|
||||
$domain_alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
|
||||
$alias = $domain_alias_storage->loadByHostname($current_hostname);
|
||||
// dpm($alias, '$alias');
|
||||
$current_domain_id = $alias->getDomainId();
|
||||
}
|
||||
|
||||
$is_mobile_domain = $current_domain_id == $mobile_domain_id;
|
||||
|
||||
if($is_mobile_domain){
|
||||
array_unshift($suggestions, 'edlp_home__mobile');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user