Created
April 13, 2015 20:11
-
-
Save matthewpoer/eecf01d6f0fab9b093a9 to your computer and use it in GitHub Desktop.
Sugar 7 Mobile UI - allow use of modules as subpanels without adding to the navigation menu. First add the module(s) through the typical Mobile Configuration tool, then create a hard-coded list in the CustomMetadataAPI class like below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('clients/base/api/MetadataApi.php'); | |
/** | |
* custom/clients/base/api/CustomMetadataApi.php | |
*/ | |
class CustomMetadataApi extends MetadataApi | |
{ | |
/** | |
* Extends MetadataApi::getAllMetadata() to ensure that specific modules | |
* are not shown in the Mobile Navigation menu, while still allowing the | |
* subpanels referencing these modules to be used. | |
* | |
* @param ServiceBase $api | |
* @param array $args | |
* @return array | |
*/ | |
public function getAllMetadata(ServiceBase $api, array $args) | |
{ | |
$data = parent::getAllMetadata($api, $args); | |
if ($api->platform == 'mobile') { | |
$modules_to_hide = array( | |
'Calls', | |
'Meetings', | |
'Tasks', | |
); | |
foreach ($modules_to_hide as $module) { | |
if (!empty($data['modules_info'][$module])) { | |
$data['modules_info'][$module]['display_tab'] = false; | |
$data['modules_info'][$module]['enabled'] = true; | |
$data['modules_info'][$module]['quick_create'] = false; | |
$data['modules_info'][$module]['show_subpanels'] = true; | |
$data['modules_info'][$module]['visible'] = false; | |
} | |
} | |
} | |
return $data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment