generator-chisel 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterBlocks.php +21 -39
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/AjaxEnpoints.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Blocks.php +15 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Cache.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Theme.php +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_content.scss +0 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_html.scss +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/woocommerce.php +2 -2
- package/lib/commands/create/packages-versions.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## <small>2.1.2 (2025-09-30)</small>
|
|
6
|
+
|
|
7
|
+
- minor fixes and adjustments, disable xmlrpc ([0bf6f64](https://github.com/xfiveco/generator-chisel/commit/0bf6f64))
|
|
8
|
+
|
|
9
|
+
## <small>2.1.1 (2025-05-26)</small>
|
|
10
|
+
|
|
11
|
+
- add woo hooks, get_blocks fixes, js slider adjustments ([8c02af7](https://github.com/xfiveco/generator-chisel/commit/8c02af7))
|
|
12
|
+
|
|
5
13
|
## 2.1.0 (2025-05-16)
|
|
6
14
|
|
|
7
15
|
- acf sync module as a plugin, add x5 plugins to installation script ([93b4f8a](https://github.com/xfiveco/generator-chisel/commit/93b4f8a))
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Chisel\Controllers;
|
|
4
4
|
|
|
5
|
-
use Chisel\WP\
|
|
5
|
+
use Chisel\WP\AjaxEndpoints;
|
|
6
6
|
use Chisel\Interfaces\InstanceInterface;
|
|
7
7
|
use Chisel\Interfaces\HooksInterface;
|
|
8
8
|
use Chisel\Traits\Singleton;
|
|
@@ -104,7 +104,7 @@ class AjaxController extends \WP_REST_Controller implements InstanceInterface, H
|
|
|
104
104
|
*/
|
|
105
105
|
public function callback( $request ) {
|
|
106
106
|
$callback = $this->get_callback_name( $request );
|
|
107
|
-
$ajax_endpoints = new
|
|
107
|
+
$ajax_endpoints = new AjaxEndpoints();
|
|
108
108
|
|
|
109
109
|
if ( method_exists( $ajax_endpoints, $callback ) ) {
|
|
110
110
|
if ( ! defined( 'DOING_AJAX' ) ) {
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterBlocks.php
CHANGED
|
@@ -54,20 +54,6 @@ class RegisterBlocks {
|
|
|
54
54
|
*/
|
|
55
55
|
private $blocks = array();
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Blocks option name.
|
|
59
|
-
*
|
|
60
|
-
* @var string
|
|
61
|
-
*/
|
|
62
|
-
private $blocks_option_name;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Blocks version option name.
|
|
66
|
-
*
|
|
67
|
-
* @var string
|
|
68
|
-
*/
|
|
69
|
-
private $blocks_version_option_name;
|
|
70
|
-
|
|
71
57
|
/**
|
|
72
58
|
* Theme.
|
|
73
59
|
*
|
|
@@ -102,15 +88,13 @@ class RegisterBlocks {
|
|
|
102
88
|
* @param string $blocks_type The blocks type : acf or wp.
|
|
103
89
|
*/
|
|
104
90
|
public function __construct( $blocks_type ) {
|
|
105
|
-
$this->blocks_type
|
|
106
|
-
$this->theme
|
|
107
|
-
$this->blocks_folder
|
|
108
|
-
$this->blocks_path
|
|
109
|
-
$this->blocks_path_src
|
|
110
|
-
$this->blocks_url
|
|
111
|
-
$this->blocks
|
|
112
|
-
$this->blocks_option_name = 'chisel_' . $this->blocks_type;
|
|
113
|
-
$this->blocks_version_option_name = 'chisel_' . $this->blocks_type . '_version';
|
|
91
|
+
$this->blocks_type = $blocks_type;
|
|
92
|
+
$this->theme = wp_get_theme();
|
|
93
|
+
$this->blocks_folder = $this->blocks_type === 'acf' ? 'blocks-acf' : 'blocks';
|
|
94
|
+
$this->blocks_path = get_template_directory() . '/' . $this->build_folder . '/' . $this->blocks_folder;
|
|
95
|
+
$this->blocks_path_src = get_template_directory() . '/' . $this->src_folder . '/' . $this->blocks_folder;
|
|
96
|
+
$this->blocks_url = get_template_directory_uri() . '/' . $this->build_folder . '/' . $this->blocks_folder;
|
|
97
|
+
$this->blocks = $this->get_blocks();
|
|
114
98
|
|
|
115
99
|
$this->register_scripts = apply_filters( 'chisel_blocks_register_scripts', true, $this->blocks_type );
|
|
116
100
|
}
|
|
@@ -228,29 +212,27 @@ class RegisterBlocks {
|
|
|
228
212
|
* @return array
|
|
229
213
|
*/
|
|
230
214
|
public function get_blocks() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if ( ! $blocks || version_compare( $this->theme->get( 'Version' ), $blocks_version ) ) {
|
|
235
|
-
$blocks_list = is_dir( $this->blocks_path ) ? new \DirectoryIterator( $this->blocks_path ) : array();
|
|
215
|
+
if ( $this->blocks ) {
|
|
216
|
+
return $this->blocks;
|
|
217
|
+
}
|
|
236
218
|
|
|
237
|
-
|
|
238
|
-
foreach ( $blocks_list as $item ) {
|
|
239
|
-
if ( $item->isDot() || ! $item->isDir() ) {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
219
|
+
$blocks_list = is_dir( $this->blocks_path ) ? new \DirectoryIterator( $this->blocks_path ) : array();
|
|
242
220
|
|
|
243
|
-
|
|
221
|
+
if ( $blocks_list ) {
|
|
222
|
+
foreach ( $blocks_list as $item ) {
|
|
223
|
+
if ( $item->isDot() || ! $item->isDir() ) {
|
|
224
|
+
continue;
|
|
244
225
|
}
|
|
245
|
-
}
|
|
246
226
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
227
|
+
$block_name = $item->getFilename();
|
|
228
|
+
|
|
229
|
+
if ( ! in_array( $block_name, $this->blocks, true ) ) {
|
|
230
|
+
$this->blocks[] = $item->getFilename();
|
|
231
|
+
}
|
|
250
232
|
}
|
|
251
233
|
}
|
|
252
234
|
|
|
253
|
-
return $blocks;
|
|
235
|
+
return $this->blocks;
|
|
254
236
|
}
|
|
255
237
|
|
|
256
238
|
/**
|
|
@@ -209,11 +209,22 @@ class Blocks implements InstanceInterface, HooksInterface {
|
|
|
209
209
|
return $block_content;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
$
|
|
213
|
-
$block_content = preg_replace( '/class="([^"]*) (is-layout-flow|is-layout-constrained) ([^"]*)"/', 'class="$1 $3"', $block_content ); // It overwrites margin styles. Let's get rid of it.
|
|
212
|
+
$processor = new \WP_HTML_Tag_Processor( $block_content );
|
|
214
213
|
|
|
215
|
-
if ( $
|
|
216
|
-
$
|
|
214
|
+
if ( $processor->next_tag() ) {
|
|
215
|
+
$classes_to_remove = array( 'is-layout-flow', 'is-layout-constrained' );
|
|
216
|
+
|
|
217
|
+
$processor->add_class( $custom_classnames );
|
|
218
|
+
|
|
219
|
+
foreach ( $classes_to_remove as $class ) {
|
|
220
|
+
$processor->remove_class( $class );
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if ( $block['blockName'] === 'core/table' ) {
|
|
224
|
+
$processor->add_class( 'u-table-responsive' );
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
$block_content = $processor->get_updated_html();
|
|
217
228
|
}
|
|
218
229
|
|
|
219
230
|
return $block_content;
|
|
@@ -72,6 +72,9 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
72
72
|
add_filter( 'wp_revisions_to_keep', array( $this, 'wp_revisions_to_keep' ), 99, 2 );
|
|
73
73
|
add_filter( 'heartbeat_settings', array( $this, 'heartbeat_settings' ) );
|
|
74
74
|
add_filter( 'jpeg_quality', array( $this, 'jpeg_quality' ) );
|
|
75
|
+
|
|
76
|
+
// Disable legacy support for XML-RPC.
|
|
77
|
+
add_filter( 'xmlrpc_enabled', '__return_false' );
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{{ slides_html }}
|
|
11
11
|
|
|
12
12
|
<div class="b-slider__slide swiper-slide" {% if has_thumbnails_nav %}data-thumbnail-url="{{ get_image(slide.acf_bs_image).src('medium') }}"{% endif %}>
|
|
13
|
-
{{ get_responsive_image(slide.acf_bs_image, 'large', {fetchpriority: loop.first ? 'high' : 'auto'}) }}
|
|
13
|
+
{{ get_responsive_image(slide.acf_bs_image, (block.align == 'full' ? 'full' : 'large'), {fetchpriority: loop.first ? 'high' : 'auto'}) }}
|
|
14
14
|
</div>
|
|
15
15
|
{% endset %}
|
|
16
16
|
{% endif %}
|
|
@@ -312,6 +312,12 @@ class Slider {
|
|
|
312
312
|
slideImg.removeAttribute(attr);
|
|
313
313
|
});
|
|
314
314
|
|
|
315
|
+
if (!thumbnailUrl) {
|
|
316
|
+
throw new Error(
|
|
317
|
+
'data-thumbnail-url attribute must be present on each swiper-slide element.',
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
315
321
|
const imageSize = thumbnailUrl.match(/(\d+)x(\d+)\./i);
|
|
316
322
|
|
|
317
323
|
if (imageSize?.[2]) {
|
|
@@ -16,11 +16,11 @@ if ( is_singular( 'product' ) ) {
|
|
|
16
16
|
$context['product'] = wc_get_product( $context['post']->ID );
|
|
17
17
|
|
|
18
18
|
// Get upsells ids.
|
|
19
|
-
$upsells_ids = $context['product']->get_upsell_ids();
|
|
19
|
+
$upsells_ids = apply_filters( 'chisel_woocommerce_upsell_display', true ) ? $context['product']->get_upsell_ids() : array();
|
|
20
20
|
|
|
21
21
|
// Get related / crossells products ids.
|
|
22
22
|
$related_limit = wc_get_loop_prop( 'columns' );
|
|
23
|
-
$related_ids = wc_get_related_products( $context['post']->id, $related_limit, $upsells_ids );
|
|
23
|
+
$related_ids = apply_filters( 'chisel_woocommerce_output_related_products', true ) ? wc_get_related_products( $context['post']->id, $related_limit, $upsells_ids ) : array();
|
|
24
24
|
|
|
25
25
|
$context['upsells_products'] = $upsells_ids ? Timber::get_posts( $upsells_ids ) : array();
|
|
26
26
|
$context['related_products'] = $related_ids ? Timber::get_posts( $related_ids ) : array();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "A generator for scaffolding front-end and WordPress projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"chisel": "bin/chisel.js"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"tinyqueue": "^2.0.3",
|
|
38
38
|
"update-notifier": "^4.1.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "7aabcf71d9f484090682199e93b3ab5328e511a9"
|
|
41
41
|
}
|