for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
namespace App\Providers\Assets;
use WPSteak\Providers\AbstractHookProvider;
use WPSteak\Services\Assets;
class Editor extends AbstractHookProvider {
use Assets;
/**
* {@inheritDoc}
*/
public function register_hooks(): void {
$this->add_action( 'enqueue_block_editor_assets', 'enqueue' );
}
protected function enqueue(): void {
$handle = "{$this->plugin->get_slug()}-editor";
$this->enqueue_script(
$handle,
$this->plugin->get_url( 'dist/editor.js' ),
$this->plugin->get_path( 'dist/editor.js' ),
['jquery', 'wp-i18n'],
true,
);
$this->enqueue_style(
$this->plugin->get_url( 'dist/styles/editor.css' ),
$this->plugin->get_path( 'dist/styles/editor.css' ),
if ( ! function_exists( 'wp_set_script_translations' ) ) {
return;
* The `.json` file must be on following format: domain-locale-handler.json
* You can generate this file with `po2json`
wp_set_script_translations(
$this->plugin->get_slug(),
$this->plugin->get_path( 'languages' ),