/** * Get the meters list of the account. */ function getMeters(\EntityMetadataWrapper $wrapper) { $nid = $wrapper->getIdentifier(); $query = new EntityFieldQuery(); $result = $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'iec_meter')->propertyCondition('status', NODE_PUBLISHED)->fieldCondition(OG_AUDIENCE_FIELD, 'target_id', $nid)->propertyOrderBy('nid')->execute(); if (empty($result['node'])) { return; } $nids = array_keys($result['node']); $handler = restful_get_restful_handler('iec_meters'); return $handler->get(implode(',', $nids)); }
/** * Get the children of the current category item by id. */ protected function getChildren(\EntityMetadataWrapper $wrapper) { $vocabulary = taxonomy_vocabulary_machine_name_load($this->getBundle()); $children = taxonomy_get_children($wrapper->getIdentifier(), $vocabulary->vid); // Exit if there is not children. if (empty($children)) { return; } $return = array(); // Get just an array of id. foreach ($children as $term) { $return[] = $term->tid; } return $return; }
/** * Get the "self" url. * * @param \EntityMetadataWrapper $wrapper * The wrapped entity. * * @return string * The self URL. */ protected function getEntitySelf(\EntityMetadataWrapper $wrapper) { return $this->versionedUrl($wrapper->getIdentifier()); }