diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-18 22:06:26 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-18 22:06:26 +0000 |
commit | 61a79f7b874a28ec22c40a2c990f5b9b4d4ffa7f (patch) | |
tree | 0919aea3e412237551a131d40ef59dcf6872aa46 /engine/lib | |
parent | 238ea1bef617e8a695e6b425e414ac686f7c3998 (diff) | |
download | elgg-61a79f7b874a28ec22c40a2c990f5b9b4d4ffa7f.tar.gz elgg-61a79f7b874a28ec22c40a2c990f5b9b4d4ffa7f.tar.bz2 |
Fixing list_registered_entities() from displaying things it should. You now must explicitly register object subtypes to get them to display.
git-svn-id: http://code.elgg.org/elgg/trunk@8297 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/entities.php | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 45d460383..3bc9554fa 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2032,39 +2032,43 @@ function entities_page_handler($page) { * @return string A viewable list of entities * @since 1.7.0 */ -function elgg_list_registered_entities($options) { +function elgg_list_registered_entities(array $options = array()) { $defaults = array( 'full_view' => TRUE, 'allowed_types' => TRUE, 'list_type_toggle' => FALSE, 'pagination' => TRUE, - 'offset' => 0 + 'offset' => 0, + 'types' => array(), + 'type_subtype_pairs' => array() ); $options = array_merge($defaults, $options); + //backwards compatibility if (isset($options['view_type_toggle'])) { $options['list_type_toggle'] = $options['view_type_toggle']; } - $typearray = array(); - - if ($object_types = get_registered_entity_types()) { - foreach ($object_types as $object_type => $subtype_array) { - if (in_array($object_type, $options['allowed_types']) || $options['allowed_types'] === TRUE) { - $typearray[$object_type] = array(); + $types = get_registered_entity_types(); + foreach ($types as $type => $subtype_array) { + if (in_array($type, $options['allowed_types']) || $options['allowed_types'] === TRUE) { + // you must explicitly register types to show up in here and in search for objects + if ($type == 'object') { if (is_array($subtype_array) && count($subtype_array)) { - foreach ($subtype_array as $subtype) { - $typearray[$object_type][] = $subtype; - } + $options['type_subtype_pairs'][$type] = $subtype_array; + } + } else { + if (is_array($subtype_array) && count($subtype_array)) { + $options['type_subtype_pairs'][$type] = $subtype_array; + } else { + $options['type_subtype_pairs'][$type] = ELGG_ENTITIES_ANY_VALUE; } } } } - $options['type_subtype_pairs'] = $typearray; - $count = elgg_get_entities(array_merge(array('count' => TRUE), $options)); $entities = elgg_get_entities($options); @@ -2144,7 +2148,7 @@ function update_entity_last_action($guid, $posted = NULL) { global $CONFIG; $guid = (int)$guid; $posted = (int)$posted; - + if (!$posted) { $posted = time(); } |