diff --git a/libraries/cms/installer/adapter.php b/libraries/cms/installer/adapter.php index ca62e1d023db3..747b285c29382 100644 --- a/libraries/cms/installer/adapter.php +++ b/libraries/cms/installer/adapter.php @@ -492,6 +492,12 @@ public function getElement($element = null) $element = (string) $this->getManifest()->element; } + if (!$element) + { + // Creates element from option in admin menu link + $element = $this->getMenuLinkOption(); + } + if (!$element) { $element = $this->getName(); @@ -513,6 +519,37 @@ public function getManifest() return $this->manifest; } + /** + * Get the filtered option from the component manifest administrator menu link + * + * @return string The filtered option + * + * @since 3.5 + */ + public function getMenuLinkOption() + { + // Check if the link attribute is set + if ($this->getManifest()->administration->menu->attributes()->link) + { + // Esnure the link is a string + $link = (string)$this->getManifest()->administration->menu->attributes()->link; + + $delimiter = 'option='; + + // Checks delimiter is in the link string + if (strpos($link, $delimiter) !== false) { + + // Gets the option from the link attribute + $option = substr($link, strpos($link, $delimiter) + strlen($delimiter)); + + // Filter the option for illegal characters + $option = JFilterInput::getInstance()->clean($option, 'string'); + } + } + + return $option; + } + /** * Get the filtered component name from the manifest *