From be3badba8f92795c9e00a882845f5cbd7fd95433 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 12 Apr 2016 18:59:33 +0100 Subject: [PATCH] Try changing adapter.php instead - alter element. --- libraries/cms/installer/adapter/component.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libraries/cms/installer/adapter/component.php b/libraries/cms/installer/adapter/component.php index f76cb2d1af0b9..f0e32895bff7a 100644 --- a/libraries/cms/installer/adapter/component.php +++ b/libraries/cms/installer/adapter/component.php @@ -947,24 +947,25 @@ protected function _buildAdminMenus($component_id = null) $data['title'] = (string) trim($menuElement); $data['alias'] = (string) $menuElement; - - // My changes here // Set the menu link if ((string) $menuElement->attributes()->link) { - if (preg_match('/^index\.php\?/', $menuElement->attributes()->link)) + // Checks if link attribute begins with 'index.php?' + // Allows compatibility with components made by following the MVC Component tutorial + // even though core component menu links simply begin with 'option=' + if (preg_match('/^index\.php\?/', (string) $menuElement->attributes()->link)) + { + $data['link'] = (string) $menuElement->attributes()->link; + } + else { - $goot = 'flob'; + $data['link'] = 'index.php?' . (string) $menuElement->attributes()->link; } - $menuLink = $menuElement->attributes()->link; - $data['link'] = 'index.php?' . $menuElement->attributes()->link; } - - - // Original code: - //$data['link'] = 'index.php?option=' . $option; - - + else + { + $data['link'] = 'index.php?option=' . $option; + } $data['type'] = 'component'; $data['published'] = 0; $data['parent_id'] = 1;