public static function UIkitComponents::getUIkitLibraryVersion in UIkit Components 8
Same name and namespace in other branches
- 8.3 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.
2 calls to UIkitComponents::getUIkitLibraryVersion()
- template_preprocess_uikit_view_grid in uikit_views/
includes/ uikit_views.theme.inc - Prepares variables for UIkit Grid templates.
- UIkitComponentsAdminForm::buildForm in src/
Form/ UIkitComponentsAdminForm.php - Form constructor.
File
- src/
UIkitComponents.php, line 86
Class
- UIkitComponents
- Class UIkitComponents
Namespace
Drupal\uikit_componentsCode
public static function getUIkitLibraryVersion() {
$theme_list = \Drupal::service('theme_handler')
->listInfo();
// Translatable strings.
$t_args = [
':uikit_project' => Url::fromUri('https://www.drupal.org/project/uikit')
->toString(),
':themes_page' => Url::fromRoute('system.themes_page')
->toString(),
];
if (isset($theme_list['uikit'])) {
$uikit_libraries = Yaml::parse(drupal_get_path('theme', 'uikit') . '/uikit.libraries.yml');
$uikit_version = explode('.', $uikit_libraries['uikit']['version']);
return implode('.', $uikit_version);
}
else {
drupal_set_message(t('The UIkit base theme is either not installed or could not be found. Please <a href=":uikit_project" target="_blank">download</a> and <a href=":themes_page">install</a> UIkit.', $t_args), 'error');
return FALSE;
}
}