Updates tainacan_the_view_modes helper function. Now it dynamically gets info from registered view modes.
This commit is contained in:
parent
73d6dcc2a1
commit
2c0c8055be
|
@ -236,10 +236,16 @@ function tainacan_the_collection_url() {
|
|||
*/
|
||||
function tainacan_get_the_view_modes() {
|
||||
$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', 'slideshow'] );
|
||||
$registered_view_modes = \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes();
|
||||
$registered_view_modes_slugs = [];
|
||||
foreach ($registered_view_modes as $key => $value) {
|
||||
array_push($registered_view_modes_slugs, $key);
|
||||
}
|
||||
$enabled_view_modes = apply_filters( 'tainacan-enabled-view-modes-for-themes', $registered_view_modes_slugs );
|
||||
return [
|
||||
'default_view_mode' => $default_view_mode,
|
||||
'enabled_view_modes' => $enabled_view_modes
|
||||
'enabled_view_modes' => $enabled_view_modes,
|
||||
'registered_view_modes' => $registered_view_modes
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ class Admin {
|
|||
'theme_collection_list_url' => get_post_type_archive_link( 'tainacan-collection' ),
|
||||
'custom_header_support' => get_theme_support('custom-header'),
|
||||
'registered_view_modes' => \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes(),
|
||||
'exposer_mapper_param' => \Tainacan\Mappers_Handler::MAPPER_PARAM,
|
||||
'exposer_mapper_param' => \Tainacan\Mappers_Handler::MAPPER_PARAM,
|
||||
'exposer_type_param' => \Tainacan\Exposers_Handler::TYPE_PARAM,
|
||||
'repository_name' => get_bloginfo('name'),
|
||||
'api_max_items_per_page' => $TAINACAN_API_MAX_ITEMS_PER_PAGE,
|
||||
|
|
Loading…
Reference in New Issue