You are here

public function Micon::getIcons in Micon 8

Same name and namespace in other branches
  1. 2.x src/Entity/Micon.php \Drupal\micon\Entity\Micon::getIcons()

Get Micon package icons with tag as key.

Return value

array The information for the IcoMoon icons.

Overrides MiconInterface::getIcons

File

src/Entity/Micon.php, line 144

Class

Micon
Defines the Micon entity.

Namespace

Drupal\micon\Entity

Code

public function getIcons() {
  if (empty($this->icons) && ($info = $this
    ->getInfo())) {
    $this->icons = [];
    foreach ($info['icons'] as $icon) {
      foreach ($icon['icon']['tags'] as $tag) {
        $icon['tag'] = $tag;
        $icon['prefix'] = $this
          ->getPrefix();
        $icon['directory'] = file_create_url($this
          ->getDirectory());
        $icon['package_id'] = $this
          ->id();
        $icon['package_label'] = $this
          ->label();
        $micon_icon = new MiconIcon($this
          ->type(), $icon);
        $this->icons[$micon_icon
          ->getSelector()] = $micon_icon;
      }
    }
  }
  return $this->icons;
}