Merge pull request #2327 from burakcakirel/setting-key

Get dynamic setting key for apps
This commit is contained in:
Cüneyt Şentürk 2021-12-01 16:37:58 +03:00 committed by GitHub
commit a3c6fc8f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 14 deletions

View File

@ -1187,8 +1187,10 @@ abstract class DocumentShow extends Base
return $textDocumentTitle; return $textDocumentTitle;
} }
if (!empty(setting($type . '.title'))) { $key = $this->getSettingKey($type, 'title');
return setting($type . '.title');
if (!empty(setting($key))) {
return setting($key);
} }
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type), 'trans_choice'); $translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type), 'trans_choice');
@ -1206,8 +1208,10 @@ abstract class DocumentShow extends Base
return $textDocumentSubheading; return $textDocumentSubheading;
} }
if (!empty(setting($type . '.subheading'))) { $key = $this->getSettingKey($type, 'subheading');
return setting($type . '.subheading');
if (!empty(setting($key))) {
return setting($key);
} }
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading'); $translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');

View File

@ -272,8 +272,10 @@ abstract class DocumentTemplate extends Base
return $textDocumentTitle; return $textDocumentTitle;
} }
if (!empty(setting($type . '.title'))) { $key = $this->getSettingKey($type, 'title');
return setting($type . '.title');
if (!empty(setting($key))) {
return setting($key);
} }
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type)); $translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type));
@ -291,8 +293,10 @@ abstract class DocumentTemplate extends Base
return $textDocumentSubheading; return $textDocumentSubheading;
} }
if (!empty(setting($type . '.subheading'))) { $key = $this->getSettingKey($type, 'subheading');
return setting($type . '.subheading');
if (!empty(setting($key))) {
return setting($key);
} }
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading'); $translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');

View File

@ -42,7 +42,7 @@ class SettingFieldCreated
continue; continue;
} }
$real_key = $type . '.' . $key; $real_key = $this->getSettingKey($type, $key);
setting()->set($real_key, $value); setting()->set($real_key, $value);
} }
@ -66,7 +66,7 @@ class SettingFieldCreated
continue; continue;
} }
$real_key = $type . '.' . $key; $real_key = setting($this->getSettingKey($type, $key));
setting()->set($real_key, $value); setting()->set($real_key, $value);
} }