Skip to content

Commit

Permalink
Issue/4 - Correct version setter variable when using asset.php file i…
Browse files Browse the repository at this point in the history
…n script loader (#5)

* Corrects the method in-which the version is set in the script loader. #4

* Corrects name for enqueue_script. #4
  • Loading branch information
alexstandiford authored Jul 9, 2021
1 parent cc877a9 commit 5f21ad2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Enqueue_Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

class Enqueue_Script extends Middleware {

public $description = 'Sets up script params necessary for AJAX and REST requests';
public $name = 'REST Middleware';
public $description = 'Enqueues a script on the front end';
public $name = 'Enqueue Script';

function do_actions() {
if ( $this->loader_item instanceof Script ) {
Expand Down
10 changes: 7 additions & 3 deletions Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ public function __construct() {

if ( is_string( $this->deps ) ) {
if ( file_exists( $this->deps ) ) {
$file = wp_parse_args( require( $this->deps ), [ 'dependencies' => [], 'version' => '' ] );
$this->deps = $file['dependencies'];
$this->version = $file['version'];
$file = wp_parse_args( require( $this->deps ), [ 'dependencies' => [], 'version' => '' ] );
$this->deps = $file['dependencies'];

// Only set the version if a version has not been specified otherwise.
if ( false === $this->ver ) {
$this->ver = $file['version'];
}
} else {
underpin()->logger()->log(
'error',
Expand Down

0 comments on commit 5f21ad2

Please sign in to comment.