File: /home/zwafgyp/lacalita/wp-content/plugins/rey-core/inc/modules/view-switcher/base.php
<?php
namespace ReyCore\Modules\ViewSwitcher;
if (!defined('ABSPATH')) exit; // Exit if accessed directly
class Base extends \ReyCore\Modules\ModuleBase {
const ASSET_HANDLE = 'reycore-module-view-switcher';
public function __construct()
{
add_action( 'reycore/woocommerce/init', [$this, 'init']);
add_action( 'reycore/woocommerce/loop/init', [$this, 'register_component']);
}
public function init() {
new Customizer();
if( ! $this->is_enabled() ){
return;
}
add_action( 'reycore/assets/register_scripts', [$this, 'register_assets']);
}
public function register_component($base){
$base->register_component( new Component );
}
public function register_assets($assets){
$assets->register_asset('styles', [
self::ASSET_HANDLE => [
'src' => self::get_path( basename( __DIR__ ) ) . '/style.css',
'deps' => ['rey-wc-loop-inlinelist'],
'version' => REY_CORE_VERSION,
'priority' => 'low',
]
]);
$assets->register_asset('scripts', [
self::ASSET_HANDLE => [
'src' => self::get_path( basename( __DIR__ ) ) . '/script.js',
'deps' => ['reycore-woocommerce'],
'version' => REY_CORE_VERSION,
]
]);
}
public function is_enabled() {
return get_theme_mod('loop_view_switcher', '1') == 1;
}
public static function __config(){
return [
'id' => basename(__DIR__),
'title' => esc_html_x('Catalog View Switcher (Columns)', 'Module name', 'rey-core'),
'description' => esc_html_x('Adds a switcher above product grids, to change the number of columns.', 'Module description', 'rey-core'),
'icon' => '',
'categories' => ['woocommerce'],
'keywords' => [''],
// 'help' => reycore__support_url('kb/'),
'video' => true,
];
}
public function module_in_use(){
return $this->is_enabled();
}
}