load() public static method

Fetch config array from a file in the config directory.
public static load ( string $config ) : array
$config string
return array
Exemplo n.º 1
0
 /**
  * Hooked on admin_init. Registers the options and enqueues admin style and javascript.
  */
 public static function actionAdminInit()
 {
     wp_enqueue_style('elasticsearch-indexer', ESI_URL . 'assets/admin/style.css');
     wp_enqueue_script('elasticsearch-indexer', ESI_URL . 'assets/admin/script.js', ['jquery']);
     foreach (Config::load('defaults') as $key => $value) {
         register_setting('esi_options_group', Config::OPTION_PREFIX . $key);
     }
 }
Exemplo n.º 2
0
 /**
  * Delete existing index, create new index and add mappings.
  */
 protected function flush()
 {
     $indexName = $this->getIndexName();
     if ($this->indices()->exists(['index' => $indexName])) {
         $this->indices()->delete(['index' => $indexName]);
     }
     $this->indices()->create(['index' => $indexName, 'body' => ['settings' => Config::load('settings'), 'mappings' => Config::load('mappings')]]);
 }