private function getOrCreateFont($fontName) {
    /** @var \Drupal\social_font\Entity\Font $font_entities */
    foreach (Font::loadMultiple() as $font_entities) {
      if ($fontName == $font_entities->get('name')->value) {
        return $font_entities->id();
      }
    }

    // Ok, so it doesn't exist.
    /* @var Font $font */
    $font = Font::create([
      'name' => $fontName,
      'user_id' => 1,
      'created' => \Drupal::time()->getRequestTime(),
      'field_fallback' => '0',
    ]);
    $font->save();
    // Return the id.
    return $font->id();

  }
private function getOrCreateFont($fontName) {
    /** @var \Drupal\social_font\Entity\Font $font_entities */
    foreach (Font::loadMultiple() as $font_entities) {
      if ($fontName == $font_entities->get('name')->value) {
        return $font_entities->id();
      }
    }

    // Ok, so it doesn't exist.
    /* @var Font $font */
    $font = Font::create([
      'name' => $fontName,
      'user_id' => 1,
      'created' => \Drupal::time()->getRequestTime(),
      'field_fallback' => '0',
    ]);
    $font->save();
    // Return the id.
    return $font->id();

  }
private function getOrCreateFont ( $ fontName ) { /** @var \Drupal\social_font\Entity\Font $font_entities */ foreach ( Font :: loadMultiple ( ) as $ font_entities ) { if ( $ fontName == $ font_entities -> get ( 'name' ) -> value ) { return $ font_entities -> id ( ) ; } } // Ok, so it doesn't exist. /* @var Font $font */ $ font = Font :: create ( [ 'name' => $ fontName , 'user_id' => 1 , 'created' => \ Drupal :: time ( ) -> getRequestTime ( ) , 'field_fallback' => '0' , ] ) ; $ font -> save ( ) ; // Return the id. return $ font -> id ( ) ; }
Get or create the font.

@param string $fontName
The font name.

@return int|mixed|null|string
Return the font.
Get or create the font .