Skip to content

Commit

Permalink
Merge pull request #79 from lightspeedwp/1.2.0/events-stylesheets
Browse files Browse the repository at this point in the history
1.2.0 - TEC Block Specific Stylesheets
  • Loading branch information
krugazul committed Dec 6, 2023
2 parents eb00afd + 9a8e84c commit 3be86a4
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 58 deletions.
Empty file.
6 changes: 3 additions & 3 deletions includes/classes/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use LSXD\Classes\Block_Setup;
use LSXD\Classes\Block_Styles;
use LSXD\Classes\Frontend;
use LSXD\Classes\WooCommerce\WooCommerce;
use LSXD\Classes\Vendors\Vendors;

/**
* The main file loading the rest of the files
Expand Down Expand Up @@ -125,7 +125,7 @@ public function load_classes() {
* @return void
*/
public function load_vendors() {
require get_template_directory() . '/includes/classes/woocommerce/class-woocommerce.php';
$this->integrations['woocommerce'] = new WooCommerce();
require get_template_directory() . '/includes/classes/vendors/class-vendors.php';
$this->integrations['vendors'] = new Vendors();
}
}
73 changes: 73 additions & 0 deletions includes/classes/vendors/class-tec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* The block styles file
*
* @package lsx-design
*/

namespace LSXD\Classes\Vendors;

/**
* All the functions that run on the frontend and the rendering of the blocks.
*
* @package LSX
* @author LightSpeed
* @license GPL3
* @link
* @copyright 2023 LightSpeed
*/
class TEC {

/**
* Handles the conditional loading of the WooCommerce files.
*
* @var array
*/
private $assets = array();

/**
* Contructor
*/
public function __construct() {
add_action( 'init', array( $this, 'enqueue_block_styles' ), 10 );
}

/**
* Returns an array of the block assets.
*
* @return array
*/
private function get_assets() {
$this->assets = array(
'tec/archive-events' => array(
'handle' => 'lsxd-tec-archive-events',
'src' => get_template_directory_uri() . '/assets/css/tec/archive-events.css',
'path' => get_template_directory() . '/assets/css/tec/archive-events.css',
),
'tribe/archive-events' => array(
'handle' => 'lsxd-tec-archive-events',
'src' => get_template_directory_uri() . '/assets/css/tec/archive-events.css',
'path' => get_template_directory() . '/assets/css/tec/archive-events.css',
),
);
return $this->assets;
}

/**
* Registers our block specific styles.
*
* @return void
*/
public function enqueue_block_styles() {
foreach ( $this->get_assets() as $name => $asset ) {
wp_enqueue_block_style(
$name,
array(
'handle' => $asset['handle'],
'src' => $asset['src'],
'path' => $asset['path'],
),
);
}
}
}
64 changes: 64 additions & 0 deletions includes/classes/vendors/class-vendors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
/**
* The core file
*
* @package lsx-design
*/

namespace LSXD\Classes\Vendors;

/**
* The main file loading file for the Vendors related functionality.
*
* @package LSX
* @author LightSpeed
* @license GPL3
* @link
* @copyright 2023 LightSpeed
*/
class Vendors {

/**
* Hold the WooCommerce Object
*
* @var WooCommerce()
*/
public $woocommerce;

/**
* Contructor
*/
public function __construct() {
add_action( 'init', array( $this, 'init' ), 1 );
}

/**
* Loads the actions we need.
*
* @return void
*/
public function init() {
if ( function_exists( 'WC' ) ) {
$this->load_woocommerce();
}
if ( class_exists( 'Tribe__Events__Main' ) ) {
$this->load_tec();
}
}

/**
* Load WooCommerce
*/
public function load_woocommerce() {
require get_template_directory() . '/includes/classes/vendors/class-woocommerce.php';
$this->woocommerce = new WooCommerce();
}

/**
* Loads The Events Calendar
*/
public function load_tec() {
require get_template_directory() . '/includes/classes/vendors/class-tec.php';
$this->woocommerce = new WooCommerce();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package lsx-design
*/

namespace LSXD\Classes\WooCommerce;
namespace LSXD\Classes\Vendors;

/**
* All the functions that run on the frontend and the rendering of the blocks.
Expand All @@ -16,7 +16,7 @@
* @link
* @copyright 2023 LightSpeed
*/
class Assets {
class WooCommerce {

/**
* Handles the conditional loading of the WooCommerce files.
Expand Down
53 changes: 0 additions & 53 deletions includes/classes/woocommerce/class-woocommerce.php

This file was deleted.

0 comments on commit 3be86a4

Please sign in to comment.