You are here

function drupalgap_load_modules in DrupalGap 7

Same name and namespace in other branches
  1. 7.2 drupalgap.module \drupalgap_load_modules()

Given a module type (contrib, custom), this loads the modules listed in settings.js and returns them as regex matches.

2 calls to drupalgap_load_modules()
drupalgap_add_module_to_settings_file in ./drupalgap.module
Given a module name, this will add it to the settings.js file, right after the last module found in the file.
drupalgap_modules_widget in ./drupalgap.module
Renders the widget to control the module's for the app from the settings page.

File

./drupalgap.module, line 594
A module to provide a bridge between Drupal websites and PhoneGap mobile applications.

Code

function drupalgap_load_modules($type) {
  $settings = drupalgap_load_settings_as_string();

  // @see http://www.phpliveregex.com/
  // original regex: [^\/]Drupal\.modules\.contrib\['(.+)'] = {.*};
  $pattern = "/[^\\/]Drupal\\.modules\\.{$type}\\['(.+)'] = {.*};/";
  $modules = array();
  $result = preg_match_all($pattern, $settings, $modules);
  if (!$result) {
    return FALSE;
  }
  return $modules;
}