function bean_load_delta in Bean (for Drupal 7) 7
Fetch a bean object by its delta.
Parameters
$delta: String specifying the bean delta.
$reset: A boolean indicating that the internal cache should be reset.
Return value
Bean A fully-loaded $bean object or FALSE if it cannot be loaded.
4 calls to bean_load_delta()
- BeanTests::testBeanAPI in tests/
BeanTests.test - Test the bean API.
- bean_block_view in ./
bean.module - Implements hook_block_view().
- bean_ctools_block_info in ./
bean.module - CTools callback for Bean blocks.
- bean_delta_load in ./
bean.module - Menu callback to load a bean by the delta
1 string reference to 'bean_load_delta'
- bean_bean_cache_clear in ./
bean.module - Implements hook_bean_cache_clear().
File
- ./
bean.module, line 572 - Block Entity
Code
function bean_load_delta($delta, $reset = FALSE, $revision = NULL) {
$deltas =& drupal_static(__FUNCTION__, array());
if (!$reset && !$revision && isset($deltas[$delta])) {
return $deltas[$delta];
}
$result = db_select('bean', 'b')
->fields('b', array(
'bid',
))
->condition('delta', $delta)
->execute();
if ($bid = $result
->fetchField()) {
if ($revision) {
return bean_load_revision($bid, $revision, $reset);
}
else {
$deltas[$delta] = bean_load($bid, $reset);
return $deltas[$delta];
}
}
return FALSE;
}