You are here

public function Micon::getIcons in Micon 2.x

Same name and namespace in other branches
  1. 8 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 152

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) {
      $icon['name'] = $icon['properties']['name'];
      $icon['tags'] = implode(",", $icon['icon']['tags']);
      $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;
}