Elgg  Version master
relationships.php
Go to the documentation of this file.
1 <?php
7 
17  return _elgg_services()->relationshipsTable->get($id);
18 }
19 
31  return _elgg_services()->relationshipsTable->getEntitiesFromCount($options);
32 }
33 
45  return elgg_list_entities($options, 'elgg_get_entities_from_relationship_count');
46 }
47 
62 function elgg_get_relationships(array $options = []) {
63  return Relationships::find($options);
64 }
65 
76 function elgg_count_relationships(array $options = []): int {
77  $options['count'] = true;
78 
79  return (int) elgg_get_relationships($options);
80 }
81 
91 function elgg_list_relationships(array $options): string {
92  $defaults = [
93  'limit' => (int) max(get_input('limit', max(25, _elgg_services()->config->default_limit)), 0),
94  'offset' => (int) max(get_input('reloff', 0), 0),
95  'sort_by' => get_input('sort_by', []),
96  ];
97 
98  $options = array_merge($defaults, $options);
99 
100  return elgg_list_entities($options, 'elgg_get_relationships', 'elgg_view_relationship_list');
101 }
elgg_list_entities_from_relationship_count(array $options)
Returns a list of entities by relationship count.
elgg_list_relationships(array $options)
Returns a rendered list of relationships with pagination.
$defaults
Generic entity header upload helper.
Definition: header.php:6
elgg_get_entities_from_relationship_count(array $options=[])
Gets the number of entities by a the number of entities related to them in a particular way...
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
elgg_get_relationship(int $id)
Get a relationship by its ID.
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
elgg_get_relationships(array $options=[])
Fetch relationships or perform a calculation on them.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:351
$id
Generic annotation delete action.
Definition: delete.php:6
Elgg relationships.
elgg_count_relationships(array $options=[])
Returns a count of relationships.