Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions libraries/src/Installer/Adapter/ModuleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,25 +330,34 @@ protected function finaliseUninstall(): bool
*
* @param string $element Optional element name to be converted
*
* @return string The filtered element
* @return string|null The filtered element
*
* @since 3.4
*/
public function getElement($element = null)
{
if (!$element)
if ($element)
{
if (\count($this->getManifest()->files->children()))
{
foreach ($this->getManifest()->files->children() as $file)
{
if ((string) $file->attributes()->module)
{
$element = strtolower((string) $file->attributes()->module);
return $element;
}

break;
}
}
// Joomla 4 Module.
if ((string) $this->getManifest()->element)
{
return (string) $this->getManifest()->element;
}

if (!\count($this->getManifest()->files->children()))
{
return $element;
}

foreach ($this->getManifest()->files->children() as $file)
{
if ((string) $file->attributes()->module)
{
// Joomla 3 (legacy) Module.
return strtolower((string) $file->attributes()->module);
}
}

Expand Down