define default and enabled view modes for repository and term items list
This commit is contained in:
parent
385ead1daa
commit
8e16284851
|
@ -182,13 +182,17 @@ function tainacan_the_faceted_search() {
|
||||||
|
|
||||||
$props = ' ';
|
$props = ' ';
|
||||||
|
|
||||||
|
$default_view_mode = apply_filters( 'tainacan-default-view-mode-for-themes', 'masonry' );
|
||||||
|
$enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', ['table', 'cards', 'masonry'] );
|
||||||
|
|
||||||
// if in a collection page
|
// if in a collection page
|
||||||
$collection_id = tainacan_get_collection_id();
|
$collection_id = tainacan_get_collection_id();
|
||||||
if ($collection_id) {
|
if ($collection_id) {
|
||||||
|
|
||||||
$props .= 'collection-id="' . $collection_id . '" ';
|
$props .= 'collection-id="' . $collection_id . '" ';
|
||||||
$collection = new \Tainacan\Entities\Collection($collection_id);
|
$collection = new \Tainacan\Entities\Collection($collection_id);
|
||||||
$props .= 'default-view-mode="' . $collection->get_default_view_mode() . '" ';
|
$default_view_mode = $collection->get_default_view_mode();
|
||||||
$props .= 'enabled-view-modes="' . implode(',', $collection->get_enabled_view_modes()) . '" ';
|
$enabled_view_modes = $collection->get_enabled_view_modes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if in a tainacan taxonomy
|
// if in a tainacan taxonomy
|
||||||
|
@ -198,6 +202,9 @@ function tainacan_the_faceted_search() {
|
||||||
$props .= 'taxonomy="' . $term->taxonomy . '" ';
|
$props .= 'taxonomy="' . $term->taxonomy . '" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$props .= 'default-view-mode="' . $default_view_mode . '" ';
|
||||||
|
$props .= 'enabled-view-modes="' . implode(',', $enabled_view_modes) . '" ';
|
||||||
|
|
||||||
echo "<div id='tainacan-items-page' $props ></div>";
|
echo "<div id='tainacan-items-page' $props ></div>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue