Mesuva / multi_page_selector_attribute_legacy

A concrete5 attribute to select multiple pages in a sortable list
2 stars 3 forks source link

Multi-Page Selector Attribute

A concrete5 attribute to select multiple pages in a sortable list

Once installed, you can fetch the attribute in a page template one of two ways:

$products = $c->getAttribute('related_products', 'pageArray');
// $products now contains an array of collection (page) objects

// or 
$products = $c->getAttribute('related_products', 'pageLinkArray');
// $products now contains an array of arrays, each containing 'cID' 'url', and 'name', meaning you can do:

if (!empty($products)) { 
    echo '<ul>';
    foreach($products as $prod) {
        echo '<li><a href="https://github.com/Mesuva/multi_page_selector_attribute_legacy/blob/master/' . $prod['url'] . '">'. $prod['name']. '</a></li>';
    }
    echo '</ul>';
}