Created
May 29, 2012 03:20
-
-
Save sun/2822341 to your computer and use it in GitHub Desktop.
Revisions
-
sun revised this gist
May 29, 2012 . 1 changed file with 20 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,23 @@ <?php function config($name, $config_class = NULL, $storage_class = NULL) { static $config_instances = array(), $storage_instances = array(); // Set defaults. if (!isset($config_class)) { $config_class = 'Drupal\Core\Config\DrupalConfig'; } if (!isset($storage_class)) { $storage_class = 'Drupal\Core\Config\DatabaseStorage'; } // Instantiate objects, if required. if (!isset($config_instances[$config_class])) { $config_instances[$config_class] = new $config_class; } if (!isset($storage_instances[$storage_class])) { $storage_instances[$storage_class] = new $storage_class; } return $config_instances[$config_class]->getConfigObject($name, $storage_instances[$storage_class]); } -
beejeebus created this gist
May 29, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <?php function config($name, $class = 'Drupal\Core\Config\DrupalConfig', $storage_class = 'Drupal\Core\Config\DatabaseStorage') { static $drupal_config, $storage_engines; if ($drupal_config === NULL) { $drupal_config = new $class(); } if (empty($storage_engines[$storage_class])) { $storage_engines[$storage_class] = new $storage_engine(); } return $drupal_config->getConfigObject($name, $storage_engines[$storage_class]); }