Merge pull request 'acf-build' (#6) from acf-build into master
Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
@@ -18,6 +18,10 @@ indent_size = 2
|
|||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.php]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Blocks Initialization.
|
||||||
|
function initBlock(blockName = '', selector = '', cb) {
|
||||||
|
document.querySelectorAll(selector).forEach((el) => cb(el));
|
||||||
|
}
|
||||||
|
|
||||||
// Scrollbars / Frame resizes notifications.
|
// Scrollbars / Frame resizes notifications.
|
||||||
(function () {
|
(function () {
|
||||||
let height;
|
let height;
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"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.21",
|
"version": "1.0.22",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@braintree/sanitize-url": "^6.0.0",
|
"@braintree/sanitize-url": "^6.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@axe-web/block-dev-tool",
|
"name": "@axe-web/block-dev-tool",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "AXE-WEB",
|
"name": "AXE-WEB",
|
||||||
"email": "office@axe-web.com",
|
"email": "office@axe-web.com",
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ class Component_Builder {
|
|||||||
* FILE INFO:
|
* FILE INFO:
|
||||||
* This file was generated by LightCandy::compile function.
|
* This file was generated by LightCandy::compile function.
|
||||||
* The original source is the .HBS(handlebars) file that is located next to this generated PHP file.
|
* The original source is the .HBS(handlebars) file that is located next to this generated PHP file.
|
||||||
|
*
|
||||||
|
* Compiled at " . date( 'Y-m-d h:i:s' ) . "
|
||||||
*/
|
*/
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|||||||
@@ -2,20 +2,17 @@
|
|||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
||||||
|
|
||||||
include_once __DIR__ . "/helpers/<%= blockClassModel %>_Defaults.php";
|
|
||||||
include_once __DIR__ . "/helpers/<%= blockClassModel %>_API.php";
|
|
||||||
|
|
||||||
class <%= blockClassModel %>_Component extends \Core\Component {
|
class <%= blockClassModel %>_Component extends \Core\Component {
|
||||||
|
|
||||||
public function get_content( $args = [] ): string {
|
public function get_content( $args = [] ): string {
|
||||||
$args = array_merge( Helpers\<%= blockClassModel %>_Defaults::default_args(), $args );
|
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical.
|
||||||
$args = Helpers\<%= blockClassModel %>_API::prepare_args( $args );
|
|
||||||
|
|
||||||
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( array_merge( [], $args ), self::class );
|
$args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::prepare_args', array_merge( $default_args, $args ) );
|
||||||
//return apply_filters( 'the_content', $output );
|
|
||||||
return $output;
|
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class );
|
||||||
|
|
||||||
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
||||||
}
|
}
|
||||||
|
|
||||||
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void {
|
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void {
|
||||||
$version = get_plugin_data( __DIR__ . "/../../scytale-custom-blocks.php" )['Version']; // In Plugins
|
$version = get_plugin_data( __DIR__ . "/../../scytale-custom-blocks.php" )['Version']; // In Plugins
|
||||||
// $version = \Core\Global_Functions::get_current_version_number(); // In Theme
|
// $version = \Core\Global_Functions::get_current_version_number(); // In Theme
|
||||||
@@ -26,7 +23,6 @@ class <%= blockClassModel %>_Component extends \Core\Component {
|
|||||||
|
|
||||||
wp_enqueue_script( 'script-block-<%= blockFilename %>' );
|
wp_enqueue_script( 'script-block-<%= blockFilename %>' );
|
||||||
}<% } %>
|
}<% } %>
|
||||||
|
|
||||||
<% if (include_elementor_widget) { %>function register_custom_logic(): void {
|
<% if (include_elementor_widget) { %>function register_custom_logic(): void {
|
||||||
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
||||||
}
|
}
|
||||||
@@ -37,25 +33,20 @@ class <%= blockClassModel %>_Component extends \Core\Component {
|
|||||||
|
|
||||||
<% } %><% if (include_acf_block) { %> function register_acf_block() {
|
<% } %><% if (include_acf_block) { %> function register_acf_block() {
|
||||||
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
||||||
'enqueue_assets' => function () {
|
'style_assets' => [
|
||||||
wp_enqueue_style( 'block-<%= blockFilename %>', plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), ['assets-style'], get_blocks_version() );<% if (include_script) { %>
|
[
|
||||||
wp_enqueue_script( 'block-<%= blockFilename %>', plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), ['assets-script'], get_blocks_version(), true );<% } %>
|
'name' => '<%= blockFilename %>',
|
||||||
},
|
'url' => plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ),
|
||||||
'default' => Helpers\<%= blockClassModel %>_Defaults::default_args(),
|
]
|
||||||
'supports' => [
|
|
||||||
//'jsx' => true,
|
|
||||||
'color' => [
|
|
||||||
'background' => true,
|
|
||||||
'text' => true,
|
|
||||||
],
|
|
||||||
'spacing' => [
|
|
||||||
'margin' => [ 'top', 'bottom' ],
|
|
||||||
'padding' => [ 'top', 'bottom' ]
|
|
||||||
],
|
],
|
||||||
|
'script_assets' => [
|
||||||
|
[
|
||||||
|
'name' => '<%= blockFilename %>',
|
||||||
|
'url' => plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ),
|
||||||
|
]
|
||||||
]
|
]
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
<% } %><% if (include_native_gutenberg_block) { %> function register_native_gutenberg_block() {
|
<% } %><% if (include_native_gutenberg_block) { %> function register_native_gutenberg_block() {
|
||||||
register_block_type( __DIR__ . '/templates/gutenberg-block/block.json' );<% if (include_script) { %>
|
register_block_type( __DIR__ . '/templates/gutenberg-block/block.json' );<% if (include_script) { %>
|
||||||
|
|
||||||
@@ -70,7 +61,6 @@ class <%= blockClassModel %>_Component extends \Core\Component {
|
|||||||
);
|
);
|
||||||
} );<% } %>
|
} );<% } %>
|
||||||
}<% } %>
|
}<% } %>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<%= blockClassModel %>_Component::get_instance();
|
<%= blockClassModel %>_Component::get_instance();
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
|
|||||||
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
json: await readJSONFile(path.join(projectPath, 'data', 'default.json'), "utf8"),
|
||||||
});
|
});
|
||||||
|
|
||||||
await createFiles(Object.assign({}, data, {defaultData: phpDataObject}), [{
|
// await createFiles(Object.assign({}, data, {defaultData: phpDataObject}), [{
|
||||||
from: `templates/helpers/Template_Defaults.php`,
|
// from: `templates/helpers/Template_Defaults.php`,
|
||||||
to: `helpers/${data.blockClassModel}_Defaults.php`,
|
// to: `helpers/${data.blockClassModel}_Defaults.php`,
|
||||||
}], {
|
// }], {
|
||||||
pathDist: distPath,
|
// pathDist: distPath,
|
||||||
generatorsPath: path.join(__dirname),
|
// generatorsPath: path.join(__dirname),
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (isElementor) {
|
if (isElementor) {
|
||||||
await createFiles(data, [{
|
await createFiles(data, [{
|
||||||
@@ -94,13 +94,13 @@ export async function buildWordPress(blockName, isBlock = false, isElementor = f
|
|||||||
generatorsPath: path.join(__dirname)
|
generatorsPath: path.join(__dirname)
|
||||||
});
|
});
|
||||||
|
|
||||||
await createFiles(data, [{
|
// await createFiles(data, [{
|
||||||
from: `templates/helpers/Template_API.php`,
|
// from: `templates/helpers/Template_API.php`,
|
||||||
to: `helpers/${data.blockClassModel}_API.php`,
|
// to: `helpers/${data.blockClassModel}_API.php`,
|
||||||
}], {
|
// }], {
|
||||||
pathDist: distPath,
|
// pathDist: distPath,
|
||||||
generatorsPath: path.join(__dirname)
|
// generatorsPath: path.join(__dirname)
|
||||||
});
|
// });
|
||||||
} else {
|
} else {
|
||||||
await createFiles(data, [{
|
await createFiles(data, [{
|
||||||
from: `templates/Template_Basic_Component.php`,
|
from: `templates/Template_Basic_Component.php`,
|
||||||
|
|||||||
Reference in New Issue
Block a user