Created
April 23, 2014 22:57
-
-
Save jedateach/11235416 to your computer and use it in GitHub Desktop.
Silverstripe non-associative array config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getRequiredFields() { | |
$fields = self::config()->required_fields; | |
//hack to allow overriding arrays in ss config | |
if(self::$required_fields != $fields){ | |
foreach(self::$required_fields as $requirement){ | |
if(($key = array_search($requirement, $fields)) !== false) { | |
unset($fields[$key]); | |
} | |
} | |
} | |
$this->extend('updateRequiredFields', $fields); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another solution could be to use a seperate array for overriding values