Skip to content
Snippets Groups Projects
Commit f2266dbc authored by Romanos Dodopoulos's avatar Romanos Dodopoulos
Browse files

Remove subthemes of an infra theme from update

Remove all subthemes of a centrally managed theme from the Update
manager. This prevents an Undefined index Notice when a locally
installed theme has a centrally managed one as base (e.g., CERN
Overwrite Theme).

See DRUPAL-65
parent bdd38237
No related branches found
No related tags found
No related merge requests found
name = CERN Integration
package = CERN
description = Provides CERN site integration for Drupal.
version = "7.X-1.9"
version = "7.X-1.10"
core = 7.x
dependencies[] = shib_auth
......
......@@ -557,7 +557,9 @@ function cern_integration_form_domain_301_redirect_admin_form_alter (&$form, &$
/**
* Implements hook_update_projects_alter().
* Remove all centrally managed modules and themes from the Update manager.
* Remove all centrally managed modules and themes from the Update manager. In addition, remove
* all local themes with a centrally managed as base. Because the update manager tries to check
* for an update of the base which causes a 'Undefined index' notice.
*/
function cern_integration_update_projects_alter(&$projects) {
// Remove all centrally managed modules.
......@@ -567,12 +569,24 @@ function cern_integration_update_projects_alter(&$projects) {
unset($projects[$module]);
}
}
// Remove all centrally managed themes.
foreach (list_themes() as $theme_obj){
// Remove all centrally managed themes and their subthemes.
$array_themes = list_themes();
foreach ($array_themes as $theme_obj) {
// Check if there is a project for that theme.
// This is normally true but not always.
if (isset($theme_obj->info['project'])) {
if (preg_match('/^sites\/all\/themes\//', $theme_obj->filename)) {
// Unset all subthemes.
if (property_exists($theme_obj, 'sub_themes')) {
foreach ($theme_obj->sub_themes as $sub_theme_folder_name => $sub_theme_name) {
// Since we can use neither the folder nor the theme name, get the project name if it is still set.
if (isset($array_themes[$sub_theme_folder_name]->info['project'])) {
$sub_theme_project_name = $array_themes[$sub_theme_folder_name]->info['project'];
unset($projects[$sub_theme_project_name]);
}
}
}
// Unset the centrally managed theme.
unset($projects[$theme_obj->info['project']]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment