You are here

public function FontAwesomeManager::determinePrefix in Font Awesome Icons 8.2

Helper function returns the prefix for an icon based on icon type.

Parameters

array $styles: An array of valid styles for the icon.

string $default: The value to assign here if it's not a brand icon.

Return value

string A valid prefix for this icon.

Overrides FontAwesomeManagerInterface::determinePrefix

File

src/FontAwesomeManager.php, line 338

Class

FontAwesomeManager
Icon Manager Service for Font Awesome.

Namespace

Drupal\fontawesome

Code

public function determinePrefix(array $styles, $default = 'fas') {

  // Determine the icon style - brands behave differently.
  foreach ($styles as $style) {
    if ($style == 'brands') {
      return 'fab';
    }
  }
  return $default;
}