Solution: How to use undocumented sort_by clause modified_subnode


Have you ever wanted to sort a standard content fetch (say 'list') using the node object's modified_subnode field? Well .. you can!


Here is a code example of how to use this undocumented sort_by clause.

{def $root_node=fetch( 'content', 'node', hash( 'node_id', $pagedata.path_array[$left_menu_depth].node_id ) )
         $left_menu_items = fetch( 'content', 'list', hash( 'parent_node_id', $root_node.node_id,
                                                                                    'sort_by', array( 'modified_subnode', false() ),
                                                                                    'load_data_map', false(),
                                                                                    'class_filter_type', 'include',
                                                                                    'class_filter_array', ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ) ) )

Worth mentioning 'modified_subnode' is not a perfect sort order, at times it may leave somethings to be desired in terms of accuracy, but for me today on it was better that using 'modified' or 'published'!