Commit f5dc56b1 authored by git's avatar git Committed by Spleshka

Issue #2343479 by R B, Spleshka: Fatal error: Call to undefined function entity_load_single()

parent 604a065b
......@@ -281,6 +281,23 @@ function _expire_get_expiration_handler($type) {
return $cache_objects[$type];
}
/**
* Loads and returns a single entity.
*
* @param $entity_type
* The entity type to load.
*
* @param $entity_id
* The ID of the Entity to load.
*
* @return mixed
* The desired entity or FALSE if it couldn't be found.
*/
function _expire_load_single_entity($entity_type, $entity_id) {
$loaded_entity = entity_load($entity_type, array($entity_id));
return reset($loaded_entity);
}
/**
* Simple print_r to html function.
*
......
......@@ -270,7 +270,7 @@ class ExpireAPI {
foreach ($field_references as $field_reference) {
// Load entity.
$field_entity = entity_load_single($field_reference['entity_type'], $field_reference['entity_id']);
$field_entity = _expire_load_single_entity($field_reference['entity_type'], $field_reference['entity_id']);
if (empty($field_entity)) {
continue;
}
......
......@@ -53,7 +53,7 @@ class ExpireVotingapi implements ExpireInterface {
if ($expire_entity_page) {
// Load entity.
$entity = entity_load_single($entity_type, $entity_id);
$entity = _expire_load_single_entity($entity_type, $entity_id);
// Check whether entity is loaded.
if (!empty($entity)) {
......@@ -71,7 +71,7 @@ class ExpireVotingapi implements ExpireInterface {
if ($expire_entity) {
// Load entity.
$entity = entity_load_single($entity_type, $entity_id);
$entity = _expire_load_single_entity($entity_type, $entity_id);
$handler = _expire_get_expiration_handler($entity_type);
if (is_object($handler) && !empty($entity)) {
$handler->expire($entity, 0, $skip_action_check = TRUE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment