-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace WpStarter\Wordpress\Dependency; | ||
|
||
class Livewire | ||
{ | ||
protected $done; | ||
protected $styleOptions=[]; | ||
protected $scriptOptions=[]; | ||
function enqueue($styleOptions=[],$scriptOptions=[]){ | ||
if(function_exists('add_action') && class_exists(\Livewire\Livewire::class) && !$this->done) { | ||
$this->styleOptions=$styleOptions; | ||
$this->scriptOptions=$scriptOptions; | ||
add_action('wp_print_styles', [$this,'outputStyles'], 11);//After other styles | ||
add_action('wp_print_footer_scripts', [$this,'outputScripts'], 9);//before other scripts | ||
$this->done=true; | ||
} | ||
return $this->done; | ||
} | ||
function outputStyles(){ | ||
echo \Livewire\Livewire::styles(); | ||
} | ||
function outputScripts(){ | ||
echo \Livewire\Livewire::scripts(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace WpStarter\Wordpress\Facades; | ||
|
||
use WpStarter\Support\Facades\Facade; | ||
|
||
/** | ||
* @method static enqueue() | ||
*/ | ||
class Livewire extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'wp.livewire'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters