Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ModuleIterator.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Framework\Module\Manager as ModuleManager;
9 
13 class ModuleIterator extends \IteratorIterator
14 {
18  private $moduleManager;
19 
24  public function __construct(
25  ModuleManager $moduleManager,
26  \Traversable $iterator
27  ) {
28  parent::__construct($iterator);
29  $this->moduleManager = $moduleManager;
30  }
31 
37  public function current()
38  {
39  $current = parent::current();
40  if (is_array($current) && isset($current['module_name'])) {
41  $current['status'] =
42  $this->moduleManager->isEnabled($current['module_name']) == 1 ? 'Enabled' : "Disabled";
43  }
44  return $current;
45  }
46 }
__construct(ModuleManager $moduleManager, \Traversable $iterator)
$moduleManager
Definition: products.php:75