You are here

public static function Font::loadActivatedFonts in @font-your-face 8.3

Returns list of enabled fonts.

Return value

array Array of fonts.

Overrides FontInterface::loadActivatedFonts

4 calls to Font::loadActivatedFonts()
FontDisplayForm::form in src/Form/FontDisplayForm.php
Gets the actual form array to be built.
FontSettingsForm::submitForm in src/Form/FontSettingsForm.php
Form submission handler.
fontyourface_page_attachments in ./fontyourface.module
Implements hook_page_attachments().
fontyourface_update_8001 in ./fontyourface.install
Updates fonts which are enabled to have enabled property in Font status.

File

src/Entity/Font.php, line 165

Class

Font
Defines the Font entity.

Namespace

Drupal\fontyourface\Entity

Code

public static function loadActivatedFonts() {
  $config = \Drupal::config('fontyourface.settings');
  $enabled_fonts = $config
    ->get('enabled_fonts');
  $fonts = [];
  foreach ($enabled_fonts as $enabled_font_url) {
    $font = self::loadByUrl($enabled_font_url);
    if (!empty($font)) {
      $fonts[$font->url->value] = $font;
    }
  }
  return $fonts;
}