@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Anomaly\SettingsModule\Setting\Contract\SettingInterface; |
4 | 4 | use Anomaly\Streams\Platform\Addon\FieldType\FieldType; |
5 | -use Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection; |
|
6 | 5 | use Illuminate\Contracts\Bus\SelfHandling; |
7 | 6 | use Illuminate\Foundation\Bus\DispatchesJobs; |
8 | 7 |
@@ -36,8 +36,6 @@ |
||
36 | 36 | * Create a new SettingRepositoryInterface instance. |
37 | 37 | * |
38 | 38 | * @param SettingModel $model |
39 | - * @param Repository $config |
|
40 | - * @param FieldTypeCollection $fieldTypes |
|
41 | 39 | */ |
42 | 40 | public function __construct(SettingModel $model) |
43 | 41 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function get($key, $default = null) |
57 | 57 | { |
58 | 58 | $setting = $this->settings->get($key); |
59 | - return ($setting)? $setting : $default; |
|
59 | + return ($setting) ? $setting : $default; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -134,6 +134,6 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function findAllByNamespace($namespace) |
136 | 136 | { |
137 | - return $this->model->where('key', 'LIKE', $namespace . '%')->get(); |
|
137 | + return $this->model->where('key', 'LIKE', $namespace.'%')->get(); |
|
138 | 138 | } |
139 | 139 | } |
@@ -27,13 +27,13 @@ |
||
27 | 27 | return [ |
28 | 28 | new \Twig_SimpleFunction( |
29 | 29 | 'setting_value', |
30 | - function ($key, $default = null) { |
|
30 | + function($key, $default = null) { |
|
31 | 31 | return $this->dispatch(new GetSettingValue($key, $default)); |
32 | 32 | } |
33 | 33 | ), |
34 | 34 | new \Twig_SimpleFunction( |
35 | 35 | 'setting', |
36 | - function ($key) { |
|
36 | + function($key) { |
|
37 | 37 | return (new Decorator())->decorate($this->dispatch(new GetSettingValueFieldType($key))); |
38 | 38 | } |
39 | 39 | ) |
@@ -74,12 +74,12 @@ |
||
74 | 74 | { |
75 | 75 | $form = $builder->getForm(); |
76 | 76 | |
77 | - $namespace = $form->getEntry() . '::'; |
|
77 | + $namespace = $form->getEntry().'::'; |
|
78 | 78 | |
79 | 79 | /* @var FieldType $field */ |
80 | 80 | foreach ($form->getFields() as $field) { |
81 | 81 | |
82 | - $key = $namespace . $field->getField(); |
|
82 | + $key = $namespace.$field->getField(); |
|
83 | 83 | $value = $form->getValue($field->getInputName()); |
84 | 84 | |
85 | 85 | $this->settings->set($key, $value); |
@@ -39,17 +39,17 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function handle(SettingFormBuilder $builder, SettingRepositoryInterface $settings) |
41 | 41 | { |
42 | - $namespace = $builder->getFormEntry() . '::'; |
|
42 | + $namespace = $builder->getFormEntry().'::'; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Get the fields from the config system. Sections are |
46 | 46 | * optionally defined the same way. |
47 | 47 | */ |
48 | - if (!$fields = $this->config->get($namespace . 'settings/settings')) { |
|
49 | - $fields = $fields = $this->config->get($namespace . 'settings', []); |
|
48 | + if (!$fields = $this->config->get($namespace.'settings/settings')) { |
|
49 | + $fields = $fields = $this->config->get($namespace.'settings', []); |
|
50 | 50 | } |
51 | 51 | |
52 | - if ($sections = $this->config->get($namespace . 'settings/sections')) { |
|
52 | + if ($sections = $this->config->get($namespace.'settings/sections')) { |
|
53 | 53 | $builder->setSections($sections); |
54 | 54 | } |
55 | 55 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $label = array_get( |
79 | 79 | $field, |
80 | 80 | 'label', |
81 | - $namespace . 'setting.' . $slug . '.label' |
|
81 | + $namespace.'setting.'.$slug.'.label' |
|
82 | 82 | ) |
83 | 83 | ) |
84 | 84 | ) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $field['label'] = array_get( |
90 | 90 | $field, |
91 | 91 | 'label', |
92 | - $namespace . 'setting.' . $slug . '.name' |
|
92 | + $namespace.'setting.'.$slug.'.name' |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | // Default the warning. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $warning = array_get( |
98 | 98 | $field, |
99 | 99 | 'warning', |
100 | - $namespace . 'setting.' . $slug . '.warning' |
|
100 | + $namespace.'setting.'.$slug.'.warning' |
|
101 | 101 | ) |
102 | 102 | ) |
103 | 103 | ) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $placeholder = array_get( |
110 | 110 | $field, |
111 | 111 | 'placeholder', |
112 | - $namespace . 'setting.' . $slug . '.placeholder' |
|
112 | + $namespace.'setting.'.$slug.'.placeholder' |
|
113 | 113 | ) |
114 | 114 | ) |
115 | 115 | ) { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $instructions = array_get( |
122 | 122 | $field, |
123 | 123 | 'instructions', |
124 | - $namespace . 'setting.' . $slug . '.instructions' |
|
124 | + $namespace.'setting.'.$slug.'.instructions' |
|
125 | 125 | ) |
126 | 126 | ) |
127 | 127 | ) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // Get the value defaulting to the default value. |
132 | - if ($value = $settings->get($namespace . $slug)) { |
|
132 | + if ($value = $settings->get($namespace.$slug)) { |
|
133 | 133 | $field['value'] = $value->getValue(); |
134 | 134 | } else { |
135 | 135 | $field['value'] = array_get($field['config'], 'default_value'); |