Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_related_items sometimes returns an Array #4

Open
gerard-kanters opened this issue Oct 20, 2014 · 4 comments
Open

get_related_items sometimes returns an Array #4

gerard-kanters opened this issue Oct 20, 2014 · 4 comments
Assignees

Comments

@gerard-kanters
Copy link

In some views the link "View all %s related items" sometimes shows "View all Array related items "instead of the number.

@propertunist
Copy link
Owner

oh ok, i haven't seen that here. is there any particular pattern to this?
e.g. does this occur regardless of how many related items there are?

the line in the code that outputs that link is:

                  echo elgg_view('output/url', array(
                        'href' => $elgg_path . 'related/' . $vars['entity']->guid,
                        'text' => elgg_echo('related-items:view-all', array($total_related_items)),
                        'is_trusted' => true,));

i am not aware of why the array would be treated as an array variable instead of using it's contents by elgg_echo. do you know?

@gerard-kanters
Copy link
Author

The pattern is yet unclear. I just did a shallow research and total_related_items uses get_related_items which has the option to count. I think that that option is not always used for all subtypes.

Maybe use something like $count = count(elgg_get_entities_from_metadata($options). but I have not tested that.

@propertunist propertunist self-assigned this Oct 25, 2014
@propertunist
Copy link
Owner

i looked through the functions being used and i am not detecting any reason as to why count would not apply to particular sub-types. why do you think that this may be the case?

i think the issue is more likely to be due to some type of type mis-match within my code, though i am not clear on where yet.

@gerard-kanters
Copy link
Author

You are right that count should be applied to all subtypes. It was a guess, because a lot of functions were called and maybe I overlooked one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants