#171 Redo the configuration layer to add a ConfigBuilder and group configuration parts
This commit is contained in:
@ -20,7 +20,6 @@ class Config extends BaseConfig
|
||||
if (is_string($this['edit_on'])) {
|
||||
return $this->prepareGithubUrl($this['edit_on']);
|
||||
} else {
|
||||
|
||||
$this['edit_on']['basepath'] = rtrim($this['edit_on']['basepath'], '/');
|
||||
|
||||
return $this['edit_on'];
|
||||
@ -28,9 +27,154 @@ class Config extends BaseConfig
|
||||
}
|
||||
|
||||
if (array_key_exists('edit_on_github', $this)) {
|
||||
return $this->prepareGithubUrl($this['edit_on_github']);
|
||||
return $this->prepareGithubUrl($this->getValue('edit_on_github'));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function hasSearch() {
|
||||
return $this->hasValue('search') && $this->getValue('search');
|
||||
}
|
||||
|
||||
public function showDateModified()
|
||||
{
|
||||
return $this->hasValue('date_modified') && $this->getValue('date_modified');
|
||||
}
|
||||
|
||||
public function showPreviousNextLinks()
|
||||
{
|
||||
if ($this->hasValue('jump_buttons')) {
|
||||
return $this->getValue('jump_buttons');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function showCodeToggle()
|
||||
{
|
||||
if ($this->hasValue('toggle_code')) {
|
||||
return $this->getValue('toggle_code');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasAutomaticTableOfContents(): bool
|
||||
{
|
||||
return $this->hasValue('auto_toc') && $this->getValue('auto_toc');
|
||||
}
|
||||
|
||||
public function hasGoogleAnalytics()
|
||||
{
|
||||
return $this->hasValue('google_analytics');
|
||||
}
|
||||
|
||||
public function getGoogleAnalyticsId()
|
||||
{
|
||||
return $this->getValue('google_analytics');
|
||||
}
|
||||
|
||||
public function hasPiwikAnalytics()
|
||||
{
|
||||
return $this->hasValue('piwik_analytics') && $this->hasValue('piwik_analytics_id');
|
||||
}
|
||||
|
||||
public function getPiwikAnalyticsId()
|
||||
{
|
||||
return $this->getValue('piwik_analytics_id');
|
||||
}
|
||||
|
||||
public function getPiwikAnalyticsUrl()
|
||||
{
|
||||
return $this->getValue('piwik_analytics');
|
||||
}
|
||||
|
||||
public function hasPoweredBy()
|
||||
{
|
||||
return $this->hasValue('powered_by') && !empty($this->getValue('powered_by'));
|
||||
}
|
||||
|
||||
public function getPoweredBy()
|
||||
{
|
||||
return $this->getValue('powered_by');
|
||||
}
|
||||
|
||||
public function hasTwitterHandles()
|
||||
{
|
||||
return $this->hasValue('twitter') && !empty($this->getValue('twitter'));
|
||||
}
|
||||
|
||||
public function getTwitterHandles()
|
||||
{
|
||||
return $this->getValue('twitter');
|
||||
}
|
||||
|
||||
public function hasLinks()
|
||||
{
|
||||
return $this->hasValue('links') && !empty($this->getValue('links'));
|
||||
}
|
||||
|
||||
public function getLinks()
|
||||
{
|
||||
return $this->getValue('links');
|
||||
}
|
||||
|
||||
public function hasRepository()
|
||||
{
|
||||
return $this->hasValue('repo') && !empty($this->getValue('repo'));
|
||||
}
|
||||
|
||||
public function getRepository()
|
||||
{
|
||||
return $this->getValue('repo');
|
||||
}
|
||||
|
||||
public function hasButtons()
|
||||
{
|
||||
return $this->hasValue('buttons') && !empty($this->getValue('buttons'));
|
||||
}
|
||||
|
||||
public function getButtons()
|
||||
{
|
||||
return $this->getValue('buttons');
|
||||
}
|
||||
|
||||
public function hasLandingPage()
|
||||
{
|
||||
if ($this->hasValue('auto_landing')) {
|
||||
return $this->getValue('auto_landing');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function hasBreadcrumbs()
|
||||
{
|
||||
if ($this->hasValue('breadcrumbs')) {
|
||||
return $this->getValue('breadcrumbs');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreadcrumbsSeparator()
|
||||
{
|
||||
return $this->getValue('breadcrumb_separator');
|
||||
}
|
||||
|
||||
public function getTheme()
|
||||
{
|
||||
return $this->getValue('theme');
|
||||
}
|
||||
|
||||
public function hasThemeVariant()
|
||||
{
|
||||
return $this->hasValue('theme-variant') && !empty($this->getValue('theme-variant'));
|
||||
}
|
||||
|
||||
public function getThemeVariant()
|
||||
{
|
||||
return $this->getValue('theme-variant');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user