PHP code example of se7enxweb / explayouts-relation-list-query

1. Go to this page and download the library: Download se7enxweb/explayouts-relation-list-query library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

se7enxweb / explayouts-relation-list-query example snippets



$items = expLayoutsRelationListQueryFactory::relation()->execute( array(
    'content_id' => 42,
    'field_identifier' => 'related_items',
    'sort_type' => 'defined_by_field',
    'limit' => 10,
) );

foreach ( $items as $item )
{
    echo $item->name . "\n"; // expLayoutsContentBrowserItem public property
}


$items = expLayoutsRelationListQueryFactory::reverseRelation()->execute( array(
    'content_id' => 42,
    'field_identifier' => 'related_items', // optional: limit to relations made through this field
    'sort_type' => 'date_published',
    'sort_direction' => 'desc',
    'limit' => 10,
) );