Collections : list view by default instead of grid

When you browse private files or pages, you will see your items displayed in a view that we call “collections”. By default, your items are displayed on a list view. You can change the default view, however, you should remember that some cookies are used to store the user choice for the next time he will browse the page. It means that after you applied this patch, you’ll need to clear your browser cookies to see the effect of this code snippet.
After you click on a view button once, a cookie will be created on the user computer to store his favorite view.

since: 7.1.5

function change_default_collection_views($data)
{
    $data['default_collection_view'] = array();

    // You can comment below whichever code is not needed

    // Globally change all views to list
    $private_types = cuar()->get_private_post_types();
    foreach ($private_types as $type) {
        $data['default_collection_view'][$type] = 'list';
    }

    // Only change default view to list for private pages
    // $data['default_collection_view']['cuar_private_page'] = 'list';

    return $data;
}

add_filter('cuar/core/js-messages?zone=frontend', 'change_default_collection_views', 100, 1);