Skip to content

Commit

Permalink
Merge pull request #16 from Firesphere/feature/fix-get-set-config
Browse files Browse the repository at this point in the history
Use proper get/set methods to allow for config overrides in YML
  • Loading branch information
fonsekaean authored Oct 26, 2017
2 parents 246ecf0 + 2dfab66 commit 194f8a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/forms/MarkdownEditorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace SilverStripers\markdown\forms;

use SilverStripe\Core\Config\Config_ForClass;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injectable;
Expand Down Expand Up @@ -135,7 +136,7 @@ public static function get($identifier = null)
*/
public static function get_active_identifier()
{
return static::$current ?: static::config()->get('default_config');
return static::config()->get('current') ?: static::config()->get('default_config');
}

/**
Expand All @@ -148,11 +149,11 @@ public static function get_active()

/**
* @param MarkdownEditorConfig $config
* @return MarkdownEditorConfig
* @return Config_ForClass
*/
public static function set_active(MarkdownEditorConfig $config)
{
return static::get_active_identifier();
return static::config()->update('current', $config);
}

/**
Expand Down

0 comments on commit 194f8a1

Please sign in to comment.