From f6c789f71668df2beaba97bb8681540a67e55e8f Mon Sep 17 00:00:00 2001 From: Saifur Rahman Mohsin Date: Thu, 3 Oct 2019 04:03:14 +0530 Subject: [PATCH] Added getConfig helper method to get config values (#4653) Credit to @SaifurRahmanMohsin Added getConfig to make it easier for developers to fetch the config data from a list column while overriding the list items through extension. This also makes the class more compatible with [FormField](https://github.com/octobercms/october/blob/master/modules/backend/classes/FormField.php) which already has the same helper function. --- modules/backend/classes/ListColumn.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/backend/classes/ListColumn.php b/modules/backend/classes/ListColumn.php index f66d55937..96384add5 100644 --- a/modules/backend/classes/ListColumn.php +++ b/modules/backend/classes/ListColumn.php @@ -219,6 +219,17 @@ class ListColumn return $this->align ? 'list-cell-align-' . $this->align : ''; } + /** + * Returns a raw config item value. + * @param string $value + * @param string $default + * @return mixed + */ + public function getConfig($value, $default = null) + { + return array_get($this->config, $value, $default); + } + /** * Returns this columns value from a supplied data set, which can be * an array or a model or another generic collection.