I am using the default table listing view, for a list of entities. In this I want to assign particular class names to the table rows based on particular metadata value on the entity. How is this possible?
I will give an idea of what I am trying to achieve below
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.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
Customize 'custom/view_1' view. Or use CSS styling: your start poimt is 'item_class' => $metadata_name,
- Sarath@sarathsince85
Sarath - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Sarath@sarathsince85
Sarath - 0 likes
'list_type' => 'my-custom-list-type', $row_attrs = [ 'class' => elgg_extract_class($vars, 'elgg-item', 'item_class $class_name_based_on_metadata'), ];
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
You must log in to post replies.You can define the custom options in the column's view:
This can customize only the columns. I want to add class names to rows based on metadata
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: