/** * Gets the HTML of the dependencies of the module * @param string $id CSS id for the dependencies container * @param array $dependencies Array with Module instances with version info * @return HTML of the dependencies */ protected function getDependenciesHtml($id, $dependencies) { $dependenciesCount = count($dependencies); if (!$dependenciesCount) { return ''; } $label = $this->translator->translatePlural($dependenciesCount, self::TRANSLATION_DEPENDS); $anchor = new Anchor($label, '#'); $jQueryEscapedId = str_replace('.', '\\\\.', $id); $anchor->setAttribute('onclick', '$("#' . $jQueryEscapedId . '").slideToggle("normal"); return false;'); $html = '<div class="info">' . PHP_EOL; $html .= $anchor->getHtml() . PHP_EOL; $html .= '<div id="' . $id . '" style="display:none;"><ul>' . PHP_EOL; foreach ($dependencies as $dependency) { $html .= '<li>' . $dependency->getNamespace() . '.' . $dependency->getName() . ' ' . $dependency->getVersion() . '</li>' . PHP_EOL; } $html .= '</ul></div></div>'; return $html; }