Thanks for considering the feature request, and the clue Jerome :)
@Jerome: I looked into the code where relationship is created between the two entities and I noticed that the event is triggered after a relationship is created. Currently it is like
This logic seems to be wrong. Why do we need 3 unnecessary db queries - read (check existing relationship) + insert (insert new relationship) + delete (delete current relationship created as it matches our condition)? Cant we prevent the creation of relationship first place itself?
This logic seems to be wrong. Why do we need 3 unnecessary db queries - read (check existing relationship) + insert (insert new relationship) + delete (delete current relationship created as it matches our condition)? Cant we prevent the creation of relationship first place itself?
Agreed, but legacy code can sometimes be a pain ;)
Seems, you can only do it using custom CSS styles
I managed to achieve this by passing
Then I copied elgg/views/default/page/components/table.php to mod/myplugin/views/default/page/components/my-custom-list-type and added my conditions in that file.
In this case, your initial code should work as is.
Try use:
'item_class' => "elgg-item $class_name_based_on_metadata",
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.