Add WordPress hook name to components.

This commit is contained in:
Roman Axelrod
2023-03-14 13:56:28 +02:00
parent 9f5c157e54
commit a4193d63e1
4 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "@axe-web/block-dev-tool", "name": "@axe-web/block-dev-tool",
"version": "1.0.26", "version": "1.0.27",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@axe-web/block-dev-tool", "name": "@axe-web/block-dev-tool",
"version": "1.0.26", "version": "1.0.27",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@braintree/sanitize-url": "^6.0.0", "@braintree/sanitize-url": "^6.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@axe-web/block-dev-tool", "name": "@axe-web/block-dev-tool",
"version": "1.0.26", "version": "1.0.27",
"author": { "author": {
"name": "AXE-WEB", "name": "AXE-WEB",
"email": "office@axe-web.com", "email": "office@axe-web.com",
@@ -4,6 +4,7 @@ namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) { %>extends \Core\Component <% } %>{ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) { %>extends \Core\Component <% } %>{
const VERSION = '<%= version %>'; const VERSION = '<%= version %>';
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';
<% if (!isComponentManager && !isElementor) { %>public function __construct() { <% if (!isComponentManager && !isElementor) { %>public function __construct() {
parent::__construct(); parent::__construct();
@@ -4,6 +4,7 @@ namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
class <%= blockClassModel %>_Component extends \Core\Component { class <%= blockClassModel %>_Component extends \Core\Component {
const VERSION = '<%= version %>'; const VERSION = '<%= version %>';
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';
public function get_content( $args = [] ): string { public function get_content( $args = [] ): string {
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical. $default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical.