DashboardService
unknown
php
2 years ago
899 B
5
Indexable
<?php namespace Drupal\mint_intranet_dashboard\Service; use Symfony\Component\Yaml\Yaml; class DashboardService { // Get all blocks from installed modules. public function getBlocks() { $blocks = []; $modules = [ 'mint_intranet_communication', ]; $installedModules = []; $moduleHandler = \Drupal::service('module_handler'); foreach ($modules as $module) { if ($moduleHandler->moduleExists($module)) { array_push($installedModules, $module); } } foreach ($installedModules as $module) { $filePath = $modulePath = $moduleHandler->getModule($module)->getPath() . '/parameters.yml'; $fileContent = Yaml::parse(file_get_contents($filePath)); if ($fileContent['dashboard'] != null) { foreach($fileContent['dashboard'] as $block) { $blocks[] = $block; } } } return $blocks; } }
Editor is loading...