* Google Fonts module file.
*/
+use Drupal\Core\Link;
+
/**
* Implements hook_fontyourface_api().
*/
];
}
+/**
+ * Implements hook_modules_installed().
+ *
+ * Use this hook instead of hook_install, because the route "font.settings" is
+ * not defined otherwise.
+ */
+function google_fonts_api_modules_installed($modules) {
+ if (in_array('google_fonts_api', $modules)) {
+ drupal_set_message(t('Due to the number of fonts, automated import from install for Google Fonts is disabled. Please use @link to import Google Fonts.', ['@link' => Link::createFromRoute('@font-your-face settings', 'font.settings')->toString()]));
+ }
+}
+
/**
* Implements hook_page_attachments().
*/
$families[$family] = urlencode($family) . ':' . implode(',', $variants);
}
- $base = 'http://fonts.googleapis.com/css?family=';
-
- if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
- $base = 'https://fonts.googleapis.com/css?family=';
- }
+ $base = 'https://fonts.googleapis.com/css?family=';
$url = $base . implode('|', $families) . '&subset=' . implode(',', $all_subsets);
$fonts[$font_id] = new stdClass();
$fonts[$font_id]->name = $font_id;
- $fonts[$font_id]->url = 'http://www.google.com/webfonts/family?family=' . $json_font->family . '&subset=' . $json_font_subset . '#' . $json_font_variant;
+ $fonts[$font_id]->url = 'https://www.google.com/webfonts/family?family=' . $json_font->family . '&subset=' . $json_font_subset . '#' . $json_font_variant;
$fonts[$font_id]->provider = 'google_fonts_api';
$fonts[$font_id]->css_family = $json_font->family;
$fonts[$font_id]->css_style = $css_style;