social_font.post_update.php in Open Social 10.2.x
Same filename and directory in other branches
- 8.9 modules/custom/social_font/social_font.post_update.php
- 8.5 modules/custom/social_font/social_font.post_update.php
- 8.6 modules/custom/social_font/social_font.post_update.php
- 8.7 modules/custom/social_font/social_font.post_update.php
- 8.8 modules/custom/social_font/social_font.post_update.php
- 10.3.x modules/custom/social_font/social_font.post_update.php
- 10.0.x modules/custom/social_font/social_font.post_update.php
- 10.1.x modules/custom/social_font/social_font.post_update.php
Post-update hooks for the Social Font module.
File
modules/custom/social_font/social_font.post_update.phpView source
<?php
/**
* @file
* Post-update hooks for the Social Font module.
*/
use Drupal\social_font\Entity\Font;
/**
* Set font-fallback for Montserrat font to sans-serif.
*/
function social_font_post_update_montserrat_fallback() {
// We assume that the number of fonts installed on a site will never be
// massive but we can't be sure that Montserrat has id 0 or 1.
$fonts = Font::loadMultiple();
/** @var Drupal\social_font\Entity\Font $font */
foreach ($fonts as $font) {
if ($font
->getName() === "Montserrat") {
// Set the fallback to use sans-serif.
$font
->set('field_fallback', "1");
$font
->save();
}
}
}
Functions
Name | Description |
---|---|
social_font_post_update_montserrat_fallback | Set font-fallback for Montserrat font to sans-serif. |