summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit2014-09-24 18:33:09 (GMT)
committerSpleshka2014-09-24 18:33:09 (GMT)
commitf5dc56b13b7a86937e78936318a0b2391cdb1a0e (patch)
tree0f7a8b66d08d2813dfb3676b48edef25d8112b8d
parent604a065bd07b0c5a706b603877739c4ac5ab3bf6 (diff)
Issue #2343479 by R B, Spleshka: Fatal error: Call to undefined function entity_load_single()
-rw-r--r--expire.module17
-rw-r--r--includes/expire.api.inc2
-rw-r--r--includes/expire.votingapi.inc4
3 files changed, 20 insertions, 3 deletions
diff --git a/expire.module b/expire.module
index 590e34a..7d7b1e6 100644
--- a/expire.module
+++ b/expire.module
@@ -282,6 +282,23 @@ function _expire_get_expiration_handler($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.
*
* @param $data
diff --git a/includes/expire.api.inc b/includes/expire.api.inc
index 0af4a66..e9cf4d0 100644
--- a/includes/expire.api.inc
+++ b/includes/expire.api.inc
@@ -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;
}
diff --git a/includes/expire.votingapi.inc b/includes/expire.votingapi.inc
index 874b235..6690730 100644
--- a/includes/expire.votingapi.inc
+++ b/includes/expire.votingapi.inc
@@ -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);