You are here

class UIkitComponents in UIkit Components 7.2

Same name and namespace in other branches
  1. 8.3 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents
  2. 8 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents
  3. 8.2 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents
  4. 7.3 src/UIkitComponents.php \Drupal\uikit_components\UIkitComponents

Provides helper functions for the UIkit Components module.

Hierarchy

Expanded class hierarchy of UIkitComponents

1 file declares its use of UIkitComponents
uikit_views.theme.inc in uikit_views/templates/uikit_views.theme.inc
Preprocessors and helper functions to make theming easier.

File

src/UIkitComponents.php, line 10

Namespace

Drupal\uikit_components
View source
class UIkitComponents {

  /**
   * Retrieves individual UIkit CDN asset using the UIkit::getCdnAsset() method.
   *
   * @param string $component
   *   The component to retrieve CDN assets for.
   */
  public static function getUIkitAsset($component = NULL) {
    if (!path_is_admin(current_path()) || self::isAdminThemeUIkitSubtheme()) {
      UIkit::getCdnAsset($component);
    }
  }

  /**
   * Determines whether the admin theme is a UIkit sub-theme.
   *
   * @return bool
   *   Returns TRUE if the admin theme is a UIkit sub-theme, otherwise returns
   *   FALSE.
   */
  private function isAdminThemeUIkitSubtheme() {
    $admin_theme = variable_get('admin_theme', 'none');
    $admin_theme_info_file = drupal_get_path('theme', $admin_theme) . "/{$admin_theme}.info";
    $admin_theme_info = drupal_parse_info_file($admin_theme_info_file);
    if (isset($admin_theme_info['base theme']) && $admin_theme_info['base theme'] == 'uikit') {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UIkitComponents::getUIkitAsset public static function Retrieves individual UIkit CDN asset using the UIkit::getCdnAsset() method.
UIkitComponents::isAdminThemeUIkitSubtheme private function Determines whether the admin theme is a UIkit sub-theme.