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.
This commit is contained in:
Saifur Rahman Mohsin 2019-10-03 04:03:14 +05:30 committed by Luke Towers
parent 8ee94cc059
commit f6c789f716
1 changed files with 11 additions and 0 deletions

View File

@ -219,6 +219,17 @@ class ListColumn
return $this->align ? 'list-cell-align-' . $this->align : ''; 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 * Returns this columns value from a supplied data set, which can be
* an array or a model or another generic collection. * an array or a model or another generic collection.