You are here

function _weight_get_settings in Weight 7.2

Get weight settings for a content type.

14 calls to _weight_get_settings()
WeightNodeHandler::fields in ./weight.migrate.inc
WeightNodeHandler::prepare in ./weight.migrate.inc
weight_apachesolr_index_document_build_node in ./weight.module
Implements hook_apachesolr_index_document_build_node().
weight_features_export_options in ./weight.features.inc
Implements hook_features_export_options().
weight_features_export_render in ./weight.features.inc
Implements hook_features_export_render().

... See full list

File

./weight.module, line 747

Code

function _weight_get_settings($type = NULL) {
  $settings =& drupal_static(__FUNCTION__);
  $query = 'SELECT * FROM {weight_settings}';
  if (!isset($settings)) {
    $settings = array();
    $result = db_query('SELECT * FROM {weight_settings}');
    foreach ($result as $row) {
      $settings[$row->type] = array(
        'enabled' => $row->weight_enabled,
        'range' => $row->weight_range,
        'menu_weight' => $row->menu_weight,
        'default' => $row->weight_default,
        'sync_translations' => $row->sync_translations,
      );
    }
  }
  if ($type && !isset($settings[$type])) {
    return array();
  }
  return $type ? $settings[$type] : $settings;
}