You are here

public function MiconIconize::getMatch in Micon 2.x

Same name and namespace in other branches
  1. 8 src/MiconIconize.php \Drupal\micon\MiconIconize::getMatch()

Match a string agaist definition and packages.

Match a string against the icon definitions and then against the Micon icon packages and return it as a MiconIcon if it exists.

Parameters

string $string: A string that will be used to search through the icon definitions as well as the Micon icons to return a confirmed match.

Return value

\Drupal\micon\MiconIcon|null The MiconIcon if found, else null.

1 call to MiconIconize::getMatch()
MiconIconize::getIcon in src/MiconIconize.php
Given a string, return the MiconIcon match.

File

src/MiconIconize.php, line 216

Class

MiconIconize
Class MiconIconize.

Namespace

Drupal\micon

Code

public function getMatch($string) {
  foreach ($this
    ->getMatchPrefix() as $prefix) {
    if ($icon_id = $this->miconDiscoveryManager
      ->getDefinitionMatch($prefix . $string)) {
      $this
        ->setIcon($icon_id);
      break;
    }
  }
  return $this->icon;
}