public static function getLayoutPath($type, $name, $layout = 'default')
{
$templateObj = Factory::getApplication()->getTemplate(true);
$defaultLayout = $layout;
$template = $templateObj->template;
if (strpos($layout, ':') !== false) {
$temp = explode(':', $layout);
$template = $temp[0] === '_' ? $templateObj->template : $temp[0];
$layout = $temp[1];
$defaultLayout = $temp[1] ?: 'default';
}
$tPath = JPATH_THEMES . '/' . $template . '/html/plg_' . $type . '_' . $name . '/' . $layout . '.php';
$iPath = JPATH_THEMES . '/' . $templateObj->parent . '/html/plg_' . $type . '_' . $name . '/' . $layout . '.php';
$bPath = JPATH_PLUGINS . '/' . $type . '/' . $name . '/tmpl/' . $defaultLayout . '.php';
$dPath = JPATH_PLUGINS . '/' . $type . '/' . $name . '/tmpl/default.php';
if (is_file($tPath)) {
return $tPath;
}
if (!empty($templateObj->parent) && is_file($iPath)) {
return $iPath;
}
if (is_file($bPath)) {
return $bPath;
}
return $dPath;
}