You are here

function LocationTestCase::getLocationFieldDefaults in Location 7.5

Same name and namespace in other branches
  1. 6.3 tests/location_testcase.php \LocationTestCase::getLocationFieldDefaults()
  2. 7.3 tests/location_testcase.test \LocationTestCase::getLocationFieldDefaults()
  3. 7.4 tests/location_testcase.php \LocationTestCase::getLocationFieldDefaults()

Get a set of location field defaults. This will also enable collection on all parts of the location field.

2 calls to LocationTestCase::getLocationFieldDefaults()
LocationCCKTest::addLocationContentType in tests/location_cck.test
LocationTestCase::addLocationContentType in tests/location_testcase.php

File

tests/location_testcase.php, line 30
Common functions for Location tests.

Class

LocationTestCase
@file Common functions for Location tests.

Code

function getLocationFieldDefaults() {

  // Get the (settable) defaults.
  $defaults = array();
  $d = location_invoke_locationapi($location, 'defaults');
  $fields = location_field_names();
  foreach ($fields as $k => $v) {
    if (!isset($d[$k]['nodiff'])) {
      $defaults[$k] = $d[$k];
    }
  }
  foreach ($defaults as $k => $v) {

    // Change collection to allow.
    $defaults[$k]['collect'] = 1;
  }
  return $defaults;
}