Skip to content

Commit

Permalink
Added support for dot nation
Browse files Browse the repository at this point in the history
Sometimes you have an array in the theme.json and you want it back as a dot notation like:

`\Theme::getSetting('header.sociale.soundcloud')`
  • Loading branch information
tomswinkels authored and igaster committed Mar 9, 2020
1 parent 161744b commit 40417ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Arr;

class Theme
{
Expand Down Expand Up @@ -187,8 +188,8 @@ public function setSetting($key, $value)

public function getSetting($key, $default = null)
{
if (array_key_exists($key, $this->settings)) {
return $this->settings[$key];
if (Arr::has($this->settings,$key)) {
return Arr::get($this->settings,$key);
} elseif ($parent = $this->getParent()) {
return $parent->getSetting($key, $default);
} else {
Expand Down

0 comments on commit 40417ad

Please sign in to comment.