do not offer additional settings when there is no content

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-06-22 15:19:01 +02:00
parent 1ace1657b6
commit 7817811d13
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 18 additions and 1 deletions

View File

@ -469,9 +469,13 @@ class Manager implements IManager {
0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],
15 => [new Section('sync-clients', $this->l->t('Sync clients'), 0, $this->url->imagePath('settings', 'change.svg'))],
98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))],
];
$legacyForms = \OC_App::getForms('personal');
if(count($legacyForms) > 0 && $this->hasLegacyPersonalSettingsToRender($legacyForms)) {
$sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))];
}
$rows = $this->mapper->getPersonalSectionsFromDB();
foreach ($rows as $row) {
@ -490,6 +494,19 @@ class Manager implements IManager {
return $sections;
}
/**
* @param $forms
* @return bool
*/
private function hasLegacyPersonalSettingsToRender($forms) {
foreach ($forms as $form) {
if(trim($form) !== '') {
return true;
}
}
return false;
}
/**
* @inheritdoc
*/