You are here

private function EditorIconDialog::buildClassString in Font Awesome Icons 8

Build Font Awesome class string from an array of attributes.

Parameters

array $attributes: The attributes being used for this Font Awesome icon.

Return value

string The class string for rendering an icon.

3 calls to EditorIconDialog::buildClassString()
EditorIconDialog::buildForm in src/Form/EditorIconDialog.php
EditorIconDialog::previewIcon in src/Form/EditorIconDialog.php
Callback for previewing the Icon.
EditorIconDialog::submitForm in src/Form/EditorIconDialog.php
Form submission handler.

File

src/Form/EditorIconDialog.php, line 299

Class

EditorIconDialog
Provides a Font Awesome icon dialog for text editors.

Namespace

Drupal\fontawesome\Form

Code

private function buildClassString(array $attributes) {
  $attributes = array_filter($attributes);
  foreach ($attributes as &$attribute) {
    if (substr($attribute, 0, 3) != 'fa-') {
      $attribute = 'fa-' . $attribute;
    }
  }
  return 'fa ' . implode(' ', $attributes);
}