function purl_load in Persistent URL 7
Same name and namespace in other branches
- 6 purl.module \purl_load()
Load a modifier from the database by provider or value.
2 calls to purl_load()
- purl_delete in ./
purl.module - Delete a modifier entry from the database.
- purl_save in ./
purl.module - Save modifier to database. Will insert new entry if no ID is provided and update an existing one otherwise.
File
- ./
purl.module, line 516
Code
function purl_load($modifier, $reset = FALSE) {
static $cache;
if (!isset($cache) || $reset) {
$cache = array();
}
foreach (array(
'id',
'value',
) as $key) {
if (isset($modifier['provider'], $modifier[$key])) {
$provider = $modifier['provider'];
$val = $modifier[$key];
if (!isset($cache[$key][$provider][$val])) {
$query = db_select('purl', 'p');
$loaded = $query
->fields('p')
->condition($key, $val)
->condition('provider', $provider)
->execute()
->fetchAssoc();
$cache[$key][$provider][$val] = $loaded;
}
return $cache[$key][$provider][$val];
}
}
return FALSE;
}