link_to_items_in_collection() will create a link to the items/browse page, where items are narrowed by a given collection. The text of the link is customizable.
Usage
<?php link_to_items_in_collection( $text = null, $props = array(), $action = 'browse', $collectionObj = null ); ?>
Arguments
- $text (string): The text for the link.
- $props (array): An array of tag attributes and their values for the link.
- $action (string): The default action route for hte link. Default is 'browse'.
- $collectionObj: The collection for which you want to create a link to items. Default is null. If null, the current collection will be used.
Examples
Simple Link in collections/show.php
The following example, which can be used on the collections/show.php template, will create a link to collections using the text 'View items in this collection', and give the link a class attribute with the value 'collection-items-link':
<?php echo link_to_items_in_collection('View items in this collection', array('class' => 'collection-items-link')); ?>
This will generate the following HTML:
<a href="http://example.com/items/browse/?collection=2" class="collection-items-link">View items in collection</a>