public static function UIkitComponents::getUIkitLibraryVersion in UIkit Components 8.3
Same name and namespace in other branches
- 8 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents::getUIkitLibraryVersion()
- 8.2 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents::getUIkitLibraryVersion()
Get the library version from the UIkit base theme.
Return value
string The major version of the UIkit library from the install UIkit base theme.
1 call to UIkitComponents::getUIkitLibraryVersion()
- AdminForm::buildForm in src/
Form/ AdminForm.php - Form constructor.
File
- src/
UIkitComponents.php, line 86
Class
- UIkitComponents
- Provides helper functions for the UIkit Components module.
Namespace
Drupal\uikit_componentsCode
public static function getUIkitLibraryVersion() {
$theme_list = \Drupal::service('theme_handler')
->listInfo();
// Translatable strings.
$t_args = [
':clear_cache' => Url::fromRoute('system.performance_settings')
->toString(),
':themes_page' => Url::fromRoute('system.themes_page')
->toString(),
':uikit_project' => Url::fromUri('https://www.drupal.org/project/uikit')
->toString(),
];
if (isset($theme_list['uikit'])) {
$uikit_libraries = Yaml::parse(file_get_contents(drupal_get_path('theme', 'uikit') . '/uikit.libraries.yml'));
return $uikit_libraries['uikit']['version'];
}
else {
\Drupal::messenger()
->addError(t('The UIkit base theme is either not installed or enabled. Please <a href=":themes_page">enable</a>, or <a href=":uikit_project" target="_blank">download</a> and <a href=":themes_page">install</a> UIkit. If UIkit is installed and enabled, try <a href=":clear_cache">clearing all caches</a>.', $t_args));
return FALSE;
}
}