Created
July 12, 2017 16:55
-
-
Save ygerasimov/e86e5b0ec93067d757e82bfbfa7afbfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Enable Google Analytics module. | |
*/ | |
function openy_update_8011() { | |
// Enable module. | |
\Drupal::service('module_installer')->install(['google_analytics']); | |
} | |
/** | |
* Enable Metatag, Redirect and Simple Sitemap modules. | |
*/ | |
function openy_update_8012() { | |
// Enable module. | |
\Drupal::service('module_installer')->install([ | |
'metatag', | |
'redirect', | |
'simple_sitemap' | |
]); | |
// Set the frontpage to be canonical url instead of alias. We expect node to be there. | |
$config_factory = Drupal::configFactory(); | |
$url = $config_factory->getEditable('system.site')->get('page.front'); | |
if (strpos($url, 'node/') !== FALSE) { | |
return; | |
} | |
$aliasStorage = \Drupal::service('path.alias_storage'); | |
$alias = $aliasStorage->load(['alias' => $url]); | |
if (!empty($alias) && strpos($alias['source'], '/node/') !== FALSE) { | |
$config_factory->getEditable('system.site')->set('page.front', $alias['source'])->save(); | |
$aliasStorage->delete(['alias' => $url]); | |
} | |
} | |
/** | |
* Enable Webforms set of modules. | |
*/ | |
function openy_update_8022() { | |
// Enable module. | |
\Drupal::service('module_installer')->install([ | |
'webform', | |
'webform_ui', | |
'captcha', | |
'image_captcha', | |
'recaptcha', | |
'openy_prgf_webform', | |
]); | |
} | |
/** | |
* Enable Webforms set of modules. | |
*/ | |
function openy_update_8022() { | |
// Enable module. | |
\Drupal::service('module_installer')->install([ | |
'webform', | |
'webform_ui', | |
'captcha', | |
'image_captcha', | |
'recaptcha', | |
'openy_prgf_webform', | |
]); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment