You are here

function ds_get_settings in Display Suite 6.3

Same name and namespace in other branches
  1. 6.2 ds.module \ds_get_settings()

Get settings

Parameters

string $module The name of the module:

string $type The name of the type:

string $build_mode The name of the build mode:

string $return The name of the record to return:

string $reset Whether to reset the static cache or not.:

9 calls to ds_get_settings()
dsDisplay::initialise in includes/dsDisplay.php
Initialise a display object
ds_display_overview_form in includes/ds.display.inc
Menu callback; presents a listing of fields display settings for an object type.
ds_get_fields in ./ds.module
API function to get fields.
ds_import_data in includes/ds.tools.inc
Import data function.
ds_render_content in includes/ds.api.inc
Render content for an object.

... See full list

File

./ds.module, line 458

Code

function ds_get_settings($module, $type, $build_mode, $return = 'settings', $reset = FALSE) {
  static $settings = array();
  if ($reset) {
    $settings = array();
  }
  if (!isset($settings[$module][$type][$build_mode])) {
    $settings[$module][$type][$build_mode] = array();
    $record = db_fetch_array(db_query("SELECT module, type, build_mode, settings, fields FROM {ds_settings} WHERE module = '%s' AND type = '%s' AND build_mode = '%s'", $module, $type, $build_mode));
    if (isset($record['module'])) {
      $settings[$module][$type][$build_mode]['settings'] = unserialize($record['settings']);
      $settings[$module][$type][$build_mode]['fields'] = unserialize($record['fields']);
    }

    // Ensure that settings always returns a layout value, even one none is set
    if (!isset($settings[$module][$type][$build_mode]['settings']['layout'])) {
      $settings[$module][$type][$build_mode]['settings']['layout'] = DS_DEFAULT_LAYOUT;
    }
  }
  return isset($settings[$module][$type][$build_mode][$return]) ? $settings[$module][$type][$build_mode][$return] : array();
}