You are here

public function WeMegaMenuAdminController::getIcons in Drupal Mega Menu 8.x

Same name and namespace in other branches
  1. 8 src/Controller/WeMegaMenuAdminController.php \Drupal\we_megamenu\Controller\WeMegaMenuAdminController::getIcons()

Render list icon font awesome.

1 string reference to 'WeMegaMenuAdminController::getIcons'
we_megamenu.routing.yml in ./we_megamenu.routing.yml
we_megamenu.routing.yml

File

src/Controller/WeMegaMenuAdminController.php, line 200

Class

WeMegaMenuAdminController
Controller routines for block example routes.

Namespace

Drupal\we_megamenu\Controller

Code

public function getIcons() {
  $file = DRUPAL_ROOT . '/' . $this->moduleHandler
    ->getModule('we_megamenu')
    ->getPath() . '/assets/resources/icon.wemegamenu';
  $fh = fopen($file, 'r');
  $result = [];
  while ($line = fgets($fh)) {
    $result[] = trim($line);
  }
  fclose($fh);
  echo json_encode($result);
  exit;
}