Skip to content

Instantly share code, notes, and snippets.

@andy-blum
Created March 14, 2019 12:18
Show Gist options
  • Save andy-blum/17e191ebdc0bcd2e5e946f4234b388ba to your computer and use it in GitHub Desktop.
Save andy-blum/17e191ebdc0bcd2e5e946f4234b388ba to your computer and use it in GitHub Desktop.
My frequent preprocess additions
/**
* Implements template_preprocess().
*/
function theme_preprocess(&$variables) {
/* Set variables to icon library */
$variables['icons'] = '/themes/custom/THEME/assets/icons';
$variables['brand_ico'] = '/themes/custom/THEME/assets/icons/brands.svg';
$variables['light_ico'] = '/themes/custom/THEME/assets/icons/light.svg';
$variables['regular_ico'] = '/themes/custom/THEME/assets/icons/regular.svg';
$variables['solid_ico'] = '/themes/custom/THEME/assets/icons/solid.svg';
/* Set variables to path & path arguments */
$variables['path_info']['full'] = \Drupal::request()->getPathInfo();;
$variables['path_info']['args'] = explode('/', trim($variables['path_info']['full'], '/'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment