Skip to content

Commit

Permalink
Merge pull request #1 from bigbite/feat/use-core-components
Browse files Browse the repository at this point in the history
Use Core functionality to obtain and save data
  • Loading branch information
chrishall0 authored Jun 22, 2023
2 parents fe9c358 + 13cb61b commit 53a933f
Show file tree
Hide file tree
Showing 22 changed files with 15,331 additions and 11,465 deletions.
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"inc/constants.php",
"inc/asset-settings.php",
"inc/utils.php",
"inc/class-filters.php",
"inc/class-custom-routes.php",
"inc/class-admin.php",
"inc/setup.php"
],
Expand Down
59 changes: 34 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 0 additions & 65 deletions inc/class-custom-routes.php

This file was deleted.

65 changes: 0 additions & 65 deletions inc/class-filters.php

This file was deleted.

79 changes: 43 additions & 36 deletions inc/class-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,47 @@
/**
* Loader for handling assets.
*/
class Loader {
const SCRIPT_NAME = 'themer-script';
const STYLE_NAME = 'themer-style';

/**
* Initialise the hooks and filters.
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_block_editor_assets' ], 1 );
}

/**
* Enqueue any required assets for the block editor.
*
* @return void
*/
public function enqueue_block_editor_assets() : void {
$plugin_name = basename( THEMER_DIR );

wp_enqueue_style( 'wp-components' );

wp_enqueue_script(
self::SCRIPT_NAME,
plugins_url( $plugin_name . '/dist/scripts/' . THEMER_EDITOR_JS, $plugin_name ),
[ 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-plugins', 'wp-edit-post', 'wp-api' ],
(string) filemtime( THEMER_DIR . '/dist/scripts/' . THEMER_EDITOR_JS ),
false
);

wp_enqueue_style(
self::STYLE_NAME,
plugins_url( $plugin_name . '/dist/styles/' . THEMER_EDITOR_CSS, $plugin_name ),
[],
(string) filemtime( THEMER_DIR . '/dist/styles/' . THEMER_EDITOR_CSS )
);
}
class Loader
{
const SCRIPT_NAME = 'themer-script';
const STYLE_NAME = 'themer-style';

/**
* Initialise the hooks and filters.
*/
public function __construct() {
add_action('admin_enqueue_scripts', [ $this, 'enqueue_themer_assets' ], 1);
}

/**
* Enqueue any required assets for the themer plugin.
*
* @return void
*/
public function enqueue_themer_assets() : void {
$plugin_name = basename(THEMER_DIR);

wp_enqueue_style('wp-components');

wp_enqueue_script(
self::SCRIPT_NAME,
plugins_url($plugin_name . '/dist/scripts/' . THEMER_EDITOR_JS, $plugin_name),
[ 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-plugins', 'wp-edit-post', 'wp-api' ],
(string) filemtime(THEMER_DIR . '/dist/scripts/' . THEMER_EDITOR_JS),
false
);

wp_enqueue_style(
self::STYLE_NAME,
plugins_url($plugin_name . '/dist/styles/' . THEMER_EDITOR_CSS, $plugin_name),
[],
(string) filemtime(THEMER_DIR . '/dist/styles/' . THEMER_EDITOR_CSS)
);
}
}






2 changes: 0 additions & 2 deletions inc/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ function setup() : void {
}

new Loader();
new Filters();
new RestRoutes();
new AdminSetup();
}
Loading

0 comments on commit 53a933f

Please sign in to comment.