From bf841b43404badd6e6e1977119f5e8d87319848e Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Tue, 21 Aug 2018 13:24:59 +1000 Subject: [PATCH] Minor peer review --- modules/backend/formwidgets/ColorPicker.php | 20 +++++++++++--------- modules/system/classes/PluginManager.php | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/backend/formwidgets/ColorPicker.php b/modules/backend/formwidgets/ColorPicker.php index e2f8485f9..6c4f24eff 100644 --- a/modules/backend/formwidgets/ColorPicker.php +++ b/modules/backend/formwidgets/ColorPicker.php @@ -1,7 +1,7 @@ vars['name'] = $this->getFieldName(); $this->vars['value'] = $value = $this->getLoadValue(); - $this->vars['availableColors'] = $this->getAvailableColors(); + $this->vars['availableColors'] = $availableColors = $this->getAvailableColors(); $this->vars['allowEmpty'] = $this->allowEmpty; $this->vars['showAlpha'] = $this->showAlpha; - $this->vars['isCustomColor'] = !in_array($value, $this->vars['availableColors']); + $this->vars['isCustomColor'] = !in_array($value, $availableColors); } /** @@ -93,11 +93,13 @@ class ColorPicker extends FormWidgetBase */ protected function getAvailableColors() { - if (is_array($this->availableColors)) { - return $this->availableColors; - } elseif (is_string($this->availableColors) && !empty($this->availableColors)) { - if ($this->model->methodExists($this->availableColors)) { - return $this->availableColors = $this->model->{$this->availableColors}( + $availableColors = $this->availableColors; + if (is_array($availableColors)) { + return $availableColors; + } + elseif (is_string($availableColors) && !empty($availableColors)) { + if ($this->model->methodExists($availableColors)) { + return $this->availableColors = $this->model->{$availableColors}( $this->formField->fieldName, $this->formField->value, $this->formField->config @@ -105,7 +107,7 @@ class ColorPicker extends FormWidgetBase } else { throw new ApplicationException(Lang::get('backend::lang.field.colors_method_not_exists', [ 'model' => get_class($this->model), - 'method' => $this->availableColors, + 'method' => $availableColors, 'field' => $this->formField->fieldName ])); } diff --git a/modules/system/classes/PluginManager.php b/modules/system/classes/PluginManager.php index 16c4dc008..dbcb21ace 100644 --- a/modules/system/classes/PluginManager.php +++ b/modules/system/classes/PluginManager.php @@ -537,7 +537,7 @@ class PluginManager return; } - $disabled = Db::table('system_plugin_versions')->where('is_disabled', '1')->lists('code'); + $disabled = Db::table('system_plugin_versions')->where('is_disabled', 1)->lists('code'); foreach ($disabled as $code) { $this->disabledPlugins[$code] = true;