2016-01-27 13:46:43 +13:00
|
|
|
<?php
|
|
|
|
|
2016-08-19 10:51:35 +12:00
|
|
|
namespace SilverStripe\Core\Config;
|
2016-01-27 13:46:43 +13:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides extensions to this object to integrate it with standard config API methods.
|
|
|
|
*
|
|
|
|
* Note that all classes can have configuration applied to it, regardless of whether it
|
|
|
|
* uses this trait.
|
|
|
|
*/
|
2016-11-29 12:31:16 +13:00
|
|
|
trait Configurable
|
|
|
|
{
|
2016-01-27 13:46:43 +13:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
|
|
|
* Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
|
|
|
|
* @return Config_ForClass
|
|
|
|
*/
|
|
|
|
public static function config()
|
|
|
|
{
|
2017-02-22 16:12:46 +13:00
|
|
|
return Config::forClass(get_called_class());
|
2016-11-29 12:31:16 +13:00
|
|
|
}
|
2016-01-27 13:46:43 +13:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
2017-02-22 16:12:46 +13:00
|
|
|
* Gets the uninherited value for the given config option
|
2016-11-29 12:31:16 +13:00
|
|
|
*
|
|
|
|
* @param string $name
|
2017-02-22 16:12:46 +13:00
|
|
|
* @return mixed
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
2017-02-22 16:12:46 +13:00
|
|
|
public function uninherited($name)
|
2016-11-29 12:31:16 +13:00
|
|
|
{
|
2017-02-22 16:12:46 +13:00
|
|
|
return $this->config()->uninherited($name);
|
2016-11-29 12:31:16 +13:00
|
|
|
}
|
2016-01-27 13:46:43 +13:00
|
|
|
}
|