Commit 9e9f8095 authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/Setting/' changes from 56f557f5..7bcb95b

7bcb95b Adding a setting getter
69645da Add the corresponding interface method
8c06311 Make find settings by module public
0f09c28 Adding number field
af2e69d Adding a radio input setting field

git-subtree-dir: Modules/Setting
git-subtree-split: 7bcb95b3ad179e725413c18742ed32b6a5eb7d04
parent 56f557f5
...@@ -162,8 +162,23 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin ...@@ -162,8 +162,23 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin
* @param string $module Module name * @param string $module Module name
* @return mixed * @return mixed
*/ */
private function findByModule($module) public function findByModule($module)
{ {
return $this->model->where('name', 'LIKE', $module . '_%')->get(); return $this->model->where('name', 'LIKE', $module . '_%')->get();
} }
/**
* Find the given setting name for the given module
* @param $settingName
* @param $module
* @return mixed
*/
public function findSettingForModule($settingName, $module = null)
{
if (is_null($module)) {
return $this->model->where('name', 'LIKE', "%{$settingName}")->first();
}
return $this->model->where('name', 'LIKE', "{$module}_{$settingName}")->first();
}
} }
...@@ -32,4 +32,19 @@ interface SettingRepository extends BaseRepository ...@@ -32,4 +32,19 @@ interface SettingRepository extends BaseRepository
* @return mixed * @return mixed
*/ */
public function savedModuleSettings($module); public function savedModuleSettings($module);
/**
* Find settings by module name
* @param string $module
* @return mixed
*/
public function findByModule($module);
/**
* Find the given setting name for the given module
* @param $settingName
* @param $module
* @return mixed
*/
public function findSettingForModule($settingName, $module = null);
} }
<?php $settingName = $module . '_' . $setting; ?>
<div class='form-group'>
{!! Form::label($settingName . "[$lang]", $moduleInfo['description']) !!}
<?php if (isset($settings[$settingName])): ?>
{!! Form::input('number', $settingName . "[$lang]", Input::old($settingName . "[$lang]", $settings[$settingName]->translate($lang)->value), ['class' => 'form-control', 'placeholder' => $moduleInfo['description']]) !!}
<?php else: ?>
{!! Form::input('number', $settingName . "[$lang]", Input::old($settingName . "[$lang]"), ['class' => 'form-control', 'placeholder' => $moduleInfo['description']]) !!}
<?php endif; ?>
</div>
<?php $settingName = $module . '_' . $setting; ?>
<div class="checkbox">
<?php foreach($moduleInfo['options'] as $value => $optionName): ?>
<label for="{{ $optionName . "[$lang]" }}">
<input id="{{ $optionName . "[$lang]" }}"
name="{{ $settingName . "[$lang]" }}"
type="radio"
class="flat-blue"
{{ isset($settings[$settingName]) && (bool)$settings[$settingName]->translate($lang)->value == $value ? 'checked' : '' }}
value="{{ $value }}" />
{{ $optionName }}
</label>
<?php endforeach; ?>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment