TYPO3 CMS  TYPO3_6-2
BackendModuleRepository.php
Go to the documentation of this file.
1 <?php
3 
23 
27  protected $moduleMenu;
28 
32  public function __construct() {
33  $this->moduleMenu = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleStorage');
34  }
35 
42  public function findByModuleName($name) {
43  $entries = $this->moduleMenu->getEntries();
44  $entry = $this->findByModuleNameInGivenEntries($name, $entries);
45  return $entry;
46  }
47 
55  public function findByModuleNameInGivenEntries($name, \SplObjectStorage $entries) {
56  foreach ($entries as $entry) {
57  if ($entry->getName() === $name) {
58  return $entry;
59  }
60  $children = $entry->getChildren();
61  if (count($children) > 0) {
62  $childRecord = $this->findByModuleNameInGivenEntries($name, $children);
63  if ($childRecord !== FALSE) {
64  return $childRecord;
65  }
66  }
67  }
68  return FALSE;
69  }
70 
71 }