You are here

public function EditorIconDialog::previewIcon in Font Awesome Icons 8

Callback for previewing the Icon.

File

src/Form/EditorIconDialog.php, line 248

Class

EditorIconDialog
Provides a Font Awesome icon dialog for text editors.

Namespace

Drupal\fontawesome\Form

Code

public function previewIcon(array &$form, FormStateInterface $form_state) {
  $form_values = $form_state
    ->getValues();
  $icon_class = $this
    ->buildClassString([
    $form_values['icon'],
  ] + $form_values['settings']);
  return [
    '#type' => 'html_tag',
    '#tag' => 'i',
    '#attributes' => [
      'class' => $icon_class,
    ],
    '#suffix' => $icon_class,
  ];
}