generator-chisel 2.1.2 → 2.2.0
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 +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/404.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/archive.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/author.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +7 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/footer.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +20 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Enums/AcfOptionsPageType.php +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Enums/BlocksType.php +17 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factories/RegisterAcfOptionsPage.php +78 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Factory → Factories}/RegisterBlocks.php +41 -30
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Factory → Factories}/RegisterCustomPostType.php +44 -32
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Factory → Factories}/RegisterCustomTaxonomy.php +39 -27
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/AcfHelpers.php +12 -12
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helpers/AjaxHelpers.php +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/AssetsHelpers.php +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/BlocksHelpers.php +22 -18
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helpers/CacheHelpers.php +43 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/CommentsHelpers.php +8 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/DataHelpers.php +5 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/GravityFormsHelpers.php +13 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/ImageHelpers.php +30 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/ThemeHelpers.php +29 -25
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/WoocommerceHelpers.php +15 -9
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Helper → Helpers}/YoastHelpers.php +6 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Plugin → Plugins}/GravityForms.php +13 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Plugin → Plugins}/Woocommerce.php +14 -14
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/{Plugin → Plugins}/Yoast.php +6 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Traits/PageBlocks.php +14 -14
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Traits/Singleton.php +28 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Acf.php +16 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/AcfBlocks.php +19 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/{AjaxEnpoints.php → AjaxEndpoints.php} +13 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Assets.php +42 -68
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Blocks.php +23 -23
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Cache.php +10 -11
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselImage.php +3 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselPost.php +13 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselProduct.php +11 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/ChiselProductCategory.php +10 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Comments.php +27 -35
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Components.php +44 -61
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/CustomPostTypes.php +12 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/CustomTaxonomies.php +12 -13
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Sidebars.php +6 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Site.php +7 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Theme.php +22 -22
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Twig.php +53 -48
- package/lib/commands/create/creators/app/chisel-starter-theme/index.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/page.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/search.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/single.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-styles.js +3 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/_breadcrumbs.scss +6 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/woocommerce.php +3 -3
- package/lib/commands/create/packages-versions.js +1 -1
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factory/RegisterAcfOptionsPage.php +0 -62
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/AjaxHelpers.php +0 -33
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Helper/CacheHelpers.php +0 -41
|
@@ -5,14 +5,14 @@ namespace Chisel\WP;
|
|
|
5
5
|
use Chisel\Interfaces\InstanceInterface;
|
|
6
6
|
use Chisel\Interfaces\HooksInterface;
|
|
7
7
|
use Chisel\Traits\Singleton;
|
|
8
|
-
use Chisel\
|
|
8
|
+
use Chisel\Factories\RegisterCustomTaxonomy;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Custom post types and taxonomies wrapper class.
|
|
12
12
|
*
|
|
13
13
|
* @package Chisel
|
|
14
14
|
*/
|
|
15
|
-
class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
15
|
+
final class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
16
16
|
|
|
17
17
|
use Singleton;
|
|
18
18
|
|
|
@@ -21,21 +21,21 @@ class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
|
21
21
|
*
|
|
22
22
|
* @var array
|
|
23
23
|
*/
|
|
24
|
-
private $taxonomies = array();
|
|
24
|
+
private array $taxonomies = array();
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Default taxonomy rewrite args.
|
|
28
28
|
*
|
|
29
29
|
* @var array
|
|
30
30
|
*/
|
|
31
|
-
private $default_taxonomy_rewrite_args = array();
|
|
31
|
+
private array $default_taxonomy_rewrite_args = array();
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Default taxonomy capabilities.
|
|
35
35
|
*
|
|
36
36
|
* @var array
|
|
37
37
|
*/
|
|
38
|
-
private $default_taxonomy_capabilities = array();
|
|
38
|
+
private array $default_taxonomy_capabilities = array();
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Class constructor.
|
|
@@ -50,8 +50,8 @@ class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
|
50
50
|
/**
|
|
51
51
|
* Set properties.
|
|
52
52
|
*/
|
|
53
|
-
public function set_properties() {
|
|
54
|
-
$this->default_taxonomy_capabilities = apply_filters(
|
|
53
|
+
public function set_properties(): void {
|
|
54
|
+
$this->default_taxonomy_capabilities = (array) apply_filters(
|
|
55
55
|
'chisel_default_taxonomy_capabilities',
|
|
56
56
|
array(
|
|
57
57
|
'manage_terms' => 'manage_categories',
|
|
@@ -60,7 +60,7 @@ class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
|
60
60
|
'assign_terms' => 'edit_posts',
|
|
61
61
|
)
|
|
62
62
|
);
|
|
63
|
-
$this->default_taxonomy_rewrite_args = apply_filters(
|
|
63
|
+
$this->default_taxonomy_rewrite_args = (array) apply_filters(
|
|
64
64
|
'chisel_default_taxonomy_rewrite_args',
|
|
65
65
|
array(
|
|
66
66
|
'slug' => '',
|
|
@@ -76,20 +76,19 @@ class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
|
76
76
|
/**
|
|
77
77
|
* Register action hooks.
|
|
78
78
|
*/
|
|
79
|
-
public function action_hooks() {
|
|
79
|
+
public function action_hooks(): void {
|
|
80
80
|
add_action( 'init', array( $this, 'register_taxonomies' ) );
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Register filter hooks.
|
|
85
85
|
*/
|
|
86
|
-
public function filter_hooks() {
|
|
87
|
-
}
|
|
86
|
+
public function filter_hooks(): void {}
|
|
88
87
|
|
|
89
88
|
/**
|
|
90
89
|
* Register custom taxonomies.
|
|
91
90
|
*/
|
|
92
|
-
public function register_taxonomies() {
|
|
91
|
+
public function register_taxonomies(): void {
|
|
93
92
|
$this->taxonomies = apply_filters( 'chisel_custom_taxonomies', $this->taxonomies );
|
|
94
93
|
|
|
95
94
|
if ( empty( $this->taxonomies ) ) {
|
|
@@ -111,7 +110,7 @@ class CustomTaxonomies implements InstanceInterface, HooksInterface {
|
|
|
111
110
|
/**
|
|
112
111
|
* Set custom taxonomies.
|
|
113
112
|
*/
|
|
114
|
-
private function set_taxonomies() {
|
|
113
|
+
private function set_taxonomies(): void {
|
|
115
114
|
$this->taxonomies = array(
|
|
116
115
|
// phpcs:disable
|
|
117
116
|
// 'chisel-term' => array(
|
|
@@ -20,7 +20,7 @@ class Sidebars implements InstanceInterface, HooksInterface {
|
|
|
20
20
|
*
|
|
21
21
|
* @var array
|
|
22
22
|
*/
|
|
23
|
-
private $sidebars = array();
|
|
23
|
+
private array $sidebars = array();
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Class constructor.
|
|
@@ -35,7 +35,7 @@ class Sidebars implements InstanceInterface, HooksInterface {
|
|
|
35
35
|
/**
|
|
36
36
|
* Set properties.
|
|
37
37
|
*/
|
|
38
|
-
public function set_properties() {
|
|
38
|
+
public function set_properties(): void {
|
|
39
39
|
$this->sidebars = array(
|
|
40
40
|
'blog' => array(
|
|
41
41
|
'name' => __( 'Blog', 'chisel' ),
|
|
@@ -67,23 +67,23 @@ class Sidebars implements InstanceInterface, HooksInterface {
|
|
|
67
67
|
/**
|
|
68
68
|
* Register action hooks.
|
|
69
69
|
*/
|
|
70
|
-
public function action_hooks() {
|
|
70
|
+
public function action_hooks(): void {
|
|
71
71
|
add_action( 'widgets_init', array( $this, 'register_sidebars' ) );
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Register filter hooks.
|
|
76
76
|
*/
|
|
77
|
-
public function filter_hooks() {
|
|
77
|
+
public function filter_hooks(): void {
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Register sidebars.
|
|
82
82
|
*/
|
|
83
|
-
public function register_sidebars() {
|
|
83
|
+
public function register_sidebars(): void {
|
|
84
84
|
$this->sidebars = apply_filters( 'chisel_sidebars', $this->sidebars );
|
|
85
85
|
|
|
86
|
-
if (
|
|
86
|
+
if ( empty( $this->sidebars ) ) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -15,7 +15,7 @@ use Chisel\Traits\Singleton;
|
|
|
15
15
|
*
|
|
16
16
|
* @package Chisel
|
|
17
17
|
*/
|
|
18
|
-
class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
18
|
+
final class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
19
19
|
|
|
20
20
|
use Singleton;
|
|
21
21
|
|
|
@@ -34,18 +34,17 @@ class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
|
34
34
|
/**
|
|
35
35
|
* Set properties.
|
|
36
36
|
*/
|
|
37
|
-
public function set_properties() {}
|
|
37
|
+
public function set_properties(): void {}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Register action hooks.
|
|
41
41
|
*/
|
|
42
|
-
public function action_hooks() {
|
|
43
|
-
}
|
|
42
|
+
public function action_hooks(): void {}
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* Register filter hooks.
|
|
47
46
|
*/
|
|
48
|
-
public function filter_hooks() {
|
|
47
|
+
public function filter_hooks(): void {
|
|
49
48
|
add_filter( 'timber/context', array( $this, 'add_to_context' ) );
|
|
50
49
|
add_filter( 'timber/post/classmap', array( $this, 'post_classmap' ) );
|
|
51
50
|
add_filter( 'timber/term/classmap', array( $this, 'term_classmap' ) );
|
|
@@ -57,7 +56,7 @@ class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
|
57
56
|
* @param array $context The context.
|
|
58
57
|
* @return array
|
|
59
58
|
*/
|
|
60
|
-
public function add_to_context( $context ) {
|
|
59
|
+
public function add_to_context( array $context ): array {
|
|
61
60
|
$context['logo'] = Components::get_logo();
|
|
62
61
|
$context['menus'] = Components::get_menus();
|
|
63
62
|
$context['sidebar'] = Components::get_sidebar();
|
|
@@ -73,7 +72,7 @@ class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
|
73
72
|
* @param array $classmap The class map.
|
|
74
73
|
* @return array
|
|
75
74
|
*/
|
|
76
|
-
public function post_classmap( $classmap ) {
|
|
75
|
+
public function post_classmap( array $classmap ): array {
|
|
77
76
|
$custom_classmap = array(
|
|
78
77
|
'post' => ChiselPost::class,
|
|
79
78
|
'page' => ChiselPost::class,
|
|
@@ -90,7 +89,7 @@ class Site extends TimberSite implements InstanceInterface, HooksInterface {
|
|
|
90
89
|
* @param array $classmap The class map.
|
|
91
90
|
* @return array
|
|
92
91
|
*/
|
|
93
|
-
public function term_classmap( $classmap ) {
|
|
92
|
+
public function term_classmap( array $classmap ): array {
|
|
94
93
|
$custom_classmap = array(
|
|
95
94
|
'category' => ChiselTerm::class,
|
|
96
95
|
'product_cat' => ChiselProductCategory::class,
|
|
@@ -5,14 +5,14 @@ namespace Chisel\WP;
|
|
|
5
5
|
use Chisel\Interfaces\InstanceInterface;
|
|
6
6
|
use Chisel\Interfaces\HooksInterface;
|
|
7
7
|
use Chisel\Traits\Singleton;
|
|
8
|
-
use Chisel\
|
|
8
|
+
use Chisel\Helpers\ThemeHelpers;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* WordPress Theme setup related functionality.
|
|
12
12
|
*
|
|
13
13
|
* @package Chisel
|
|
14
14
|
*/
|
|
15
|
-
class Theme implements InstanceInterface, HooksInterface {
|
|
15
|
+
final class Theme implements InstanceInterface, HooksInterface {
|
|
16
16
|
|
|
17
17
|
use Singleton;
|
|
18
18
|
|
|
@@ -21,14 +21,14 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
21
21
|
*
|
|
22
22
|
* @var array
|
|
23
23
|
*/
|
|
24
|
-
private $post_thumbnails_post_types = array( 'post' );
|
|
24
|
+
private array $post_thumbnails_post_types = array( 'post' );
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Navigation menus.
|
|
28
28
|
*
|
|
29
29
|
* @var array
|
|
30
30
|
*/
|
|
31
|
-
private $nav_menus = array();
|
|
31
|
+
private array $nav_menus = array();
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Class constructor.
|
|
@@ -43,7 +43,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
43
43
|
/**
|
|
44
44
|
* Set properties.
|
|
45
45
|
*/
|
|
46
|
-
public function set_properties() {
|
|
46
|
+
public function set_properties(): void {
|
|
47
47
|
// Set nav menus to register.
|
|
48
48
|
$this->nav_menus = array(
|
|
49
49
|
'chisel_main_nav' => __( 'Main Navigation', 'chisel' ),
|
|
@@ -54,7 +54,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
54
54
|
/**
|
|
55
55
|
* Register action hooks.
|
|
56
56
|
*/
|
|
57
|
-
public function action_hooks() {
|
|
57
|
+
public function action_hooks(): void {
|
|
58
58
|
add_action( 'init', array( $this, 'theme_supports' ), 11 );
|
|
59
59
|
add_action( 'after_setup_theme', array( $this, 'remove_post_supports' ), 99 );
|
|
60
60
|
add_action( 'init', array( $this, 'register_nav_menus' ) );
|
|
@@ -64,7 +64,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
64
64
|
/**
|
|
65
65
|
* Register filter hooks.
|
|
66
66
|
*/
|
|
67
|
-
public function filter_hooks() {
|
|
67
|
+
public function filter_hooks(): void {
|
|
68
68
|
add_filter( 'body_class', array( $this, 'body_classes' ) );
|
|
69
69
|
add_filter( 'tiny_mce_before_init', array( $this, 'mce_custom_colors' ) );
|
|
70
70
|
add_filter( 'login_headertext', array( $this, 'login_headertext' ) );
|
|
@@ -80,8 +80,8 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
80
80
|
/**
|
|
81
81
|
* Add theme supports.
|
|
82
82
|
*/
|
|
83
|
-
public function theme_supports() {
|
|
84
|
-
$this->post_thumbnails_post_types = apply_filters( 'chisel_post_thumbnails_post_types', $this->post_thumbnails_post_types );
|
|
83
|
+
public function theme_supports(): void {
|
|
84
|
+
$this->post_thumbnails_post_types = (array) apply_filters( 'chisel_post_thumbnails_post_types', $this->post_thumbnails_post_types );
|
|
85
85
|
|
|
86
86
|
add_theme_support( 'post-formats', array() );
|
|
87
87
|
add_theme_support( 'post-thumbnails', $this->post_thumbnails_post_types );
|
|
@@ -117,7 +117,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
117
117
|
/**
|
|
118
118
|
* Remove post supports.
|
|
119
119
|
*/
|
|
120
|
-
public function remove_post_supports() {
|
|
120
|
+
public function remove_post_supports(): void {
|
|
121
121
|
remove_post_type_support( 'page', 'excerpt' );
|
|
122
122
|
remove_post_type_support( 'attachment', 'comments' );
|
|
123
123
|
}
|
|
@@ -125,8 +125,8 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
125
125
|
/**
|
|
126
126
|
* Register navigation menus.
|
|
127
127
|
*/
|
|
128
|
-
public function register_nav_menus() {
|
|
129
|
-
$this->nav_menus = apply_filters( 'chisel_nav_menus', $this->nav_menus );
|
|
128
|
+
public function register_nav_menus(): void {
|
|
129
|
+
$this->nav_menus = (array) apply_filters( 'chisel_nav_menus', $this->nav_menus );
|
|
130
130
|
|
|
131
131
|
register_nav_menus( $this->nav_menus );
|
|
132
132
|
}
|
|
@@ -134,7 +134,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
134
134
|
/**
|
|
135
135
|
* Load theme internationalization files.
|
|
136
136
|
*/
|
|
137
|
-
public function i18n() {
|
|
137
|
+
public function i18n(): void {
|
|
138
138
|
// Load user's custom translations from wp-content/languages/ folder.
|
|
139
139
|
load_textdomain(
|
|
140
140
|
'chisel',
|
|
@@ -163,7 +163,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
163
163
|
*
|
|
164
164
|
* @return array
|
|
165
165
|
*/
|
|
166
|
-
public function body_classes( $classes ) {
|
|
166
|
+
public function body_classes( array $classes ): array {
|
|
167
167
|
$classes[] = 'chisel-theme';
|
|
168
168
|
|
|
169
169
|
return $classes;
|
|
@@ -176,7 +176,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
176
176
|
*
|
|
177
177
|
* @return array
|
|
178
178
|
*/
|
|
179
|
-
public function mce_custom_colors( $settings ) {
|
|
179
|
+
public function mce_custom_colors( array $settings ): array {
|
|
180
180
|
$default_colors = '
|
|
181
181
|
"000000", "Black",
|
|
182
182
|
"993300", "Burnt orange",
|
|
@@ -235,7 +235,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
235
235
|
*
|
|
236
236
|
* @return string
|
|
237
237
|
*/
|
|
238
|
-
public function login_headertext( $text ) {
|
|
238
|
+
public function login_headertext( string $text ): string {
|
|
239
239
|
$text = esc_attr( get_bloginfo( 'name' ) );
|
|
240
240
|
|
|
241
241
|
return $text;
|
|
@@ -248,7 +248,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
248
248
|
*
|
|
249
249
|
* @return string
|
|
250
250
|
*/
|
|
251
|
-
public function login_headerurl( $url ) {
|
|
251
|
+
public function login_headerurl( string $url ): string {
|
|
252
252
|
$url = esc_url( get_bloginfo( 'url' ) );
|
|
253
253
|
|
|
254
254
|
return $url;
|
|
@@ -257,12 +257,12 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
257
257
|
/**
|
|
258
258
|
* Set the limit of revisions to keep.
|
|
259
259
|
*
|
|
260
|
-
* @param int
|
|
261
|
-
* @param
|
|
260
|
+
* @param int $num
|
|
261
|
+
* @param \WP_Post $post
|
|
262
262
|
*
|
|
263
263
|
* @return int
|
|
264
264
|
*/
|
|
265
|
-
public function wp_revisions_to_keep( $num, $post ) {
|
|
265
|
+
public function wp_revisions_to_keep( int $num, \WP_Post $post ): int {
|
|
266
266
|
return 10;
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -273,7 +273,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
273
273
|
*
|
|
274
274
|
* @return array
|
|
275
275
|
*/
|
|
276
|
-
public function heartbeat_settings( $settings ) {
|
|
276
|
+
public function heartbeat_settings( array $settings ): array {
|
|
277
277
|
$settings['interval'] = 30;
|
|
278
278
|
|
|
279
279
|
return $settings;
|
|
@@ -286,7 +286,7 @@ class Theme implements InstanceInterface, HooksInterface {
|
|
|
286
286
|
*
|
|
287
287
|
* @return int
|
|
288
288
|
*/
|
|
289
|
-
public function jpeg_quality( $quality ) {
|
|
289
|
+
public function jpeg_quality( int $quality ): int {
|
|
290
290
|
return 90;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -7,12 +7,12 @@ use Timber\Timber;
|
|
|
7
7
|
use Chisel\Interfaces\InstanceInterface;
|
|
8
8
|
use Chisel\Interfaces\HooksInterface;
|
|
9
9
|
use Chisel\Traits\Singleton;
|
|
10
|
-
use Chisel\
|
|
11
|
-
use Chisel\
|
|
12
|
-
use Chisel\
|
|
13
|
-
use Chisel\
|
|
14
|
-
use Chisel\
|
|
15
|
-
use Chisel\
|
|
10
|
+
use Chisel\Helpers\CommentsHelpers;
|
|
11
|
+
use Chisel\Helpers\DataHelpers;
|
|
12
|
+
use Chisel\Helpers\ImageHelpers;
|
|
13
|
+
use Chisel\Helpers\ThemeHelpers;
|
|
14
|
+
use Chisel\Helpers\WoocommerceHelpers;
|
|
15
|
+
use Chisel\Helpers\YoastHelpers;
|
|
16
16
|
use Chisel\WP\Components;
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -20,7 +20,7 @@ use Chisel\WP\Components;
|
|
|
20
20
|
*
|
|
21
21
|
* @package Chisel
|
|
22
22
|
*/
|
|
23
|
-
class Twig implements InstanceInterface, HooksInterface {
|
|
23
|
+
final class Twig implements InstanceInterface, HooksInterface {
|
|
24
24
|
|
|
25
25
|
use Singleton;
|
|
26
26
|
|
|
@@ -37,28 +37,27 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
37
37
|
/**
|
|
38
38
|
* Set properties.
|
|
39
39
|
*/
|
|
40
|
-
public function set_properties() {}
|
|
40
|
+
public function set_properties(): void {}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Register action hooks.
|
|
44
44
|
*/
|
|
45
|
-
public function action_hooks() {
|
|
46
|
-
}
|
|
45
|
+
public function action_hooks(): void {}
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
* Register filter hooks.
|
|
50
49
|
*/
|
|
51
|
-
public function filter_hooks() {
|
|
50
|
+
public function filter_hooks(): void {
|
|
52
51
|
add_filter( 'timber/twig', array( $this, 'extend_twig' ) );
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* Extend Twig functionality.
|
|
57
56
|
*
|
|
58
|
-
* @param \
|
|
59
|
-
* @return \
|
|
57
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
58
|
+
* @return \Twig\Environment
|
|
60
59
|
*/
|
|
61
|
-
public function extend_twig( $twig ) {
|
|
60
|
+
public function extend_twig( \Twig\Environment $twig ): \Twig\Environment {
|
|
62
61
|
$twig = $this->register_functions( $twig );
|
|
63
62
|
$twig = $this->register_filters( $twig );
|
|
64
63
|
$twig = $this->register_tests( $twig );
|
|
@@ -69,10 +68,10 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
69
68
|
/**
|
|
70
69
|
* Register custom Twig functions.
|
|
71
70
|
*
|
|
72
|
-
* @param \
|
|
73
|
-
* @return \
|
|
71
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
72
|
+
* @return \Twig\Environment
|
|
74
73
|
*/
|
|
75
|
-
public function register_functions( $twig ) {
|
|
74
|
+
public function register_functions( \Twig\Environment $twig ): \Twig\Environment {
|
|
76
75
|
$this->register_function( $twig, 'get_nav_menu', array( $this, 'get_nav_menu' ) );
|
|
77
76
|
$this->register_function( $twig, 'timber_set_product', array( $this, 'timber_set_product' ) );
|
|
78
77
|
$this->register_function( $twig, 'post_classes', array( $this, 'post_classes' ) );
|
|
@@ -89,10 +88,10 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
89
88
|
/**
|
|
90
89
|
* Register custom Twig filters.
|
|
91
90
|
*
|
|
92
|
-
* @param \
|
|
93
|
-
* @return \
|
|
91
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
92
|
+
* @return \Twig\Environment
|
|
94
93
|
*/
|
|
95
|
-
public function register_filters( $twig ) {
|
|
94
|
+
public function register_filters( \Twig\Environment $twig ): \Twig\Environment {
|
|
96
95
|
|
|
97
96
|
return $twig;
|
|
98
97
|
}
|
|
@@ -100,10 +99,10 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
100
99
|
/**
|
|
101
100
|
* Register custom Twig tests.
|
|
102
101
|
*
|
|
103
|
-
* @param \
|
|
104
|
-
* @return \
|
|
102
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
103
|
+
* @return \Twig\Environment
|
|
105
104
|
*/
|
|
106
|
-
public function register_tests( $twig ) {
|
|
105
|
+
public function register_tests( \Twig\Environment $twig ): \Twig\Environment {
|
|
107
106
|
|
|
108
107
|
return $twig;
|
|
109
108
|
}
|
|
@@ -111,13 +110,13 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
111
110
|
/**
|
|
112
111
|
* Register a Twig function.
|
|
113
112
|
*
|
|
114
|
-
* @param \
|
|
113
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
115
114
|
* @param string $name The name of the function.
|
|
116
115
|
* @param callable $callback The callback function.
|
|
117
116
|
*
|
|
118
|
-
* @return \
|
|
117
|
+
* @return \Twig\Environment
|
|
119
118
|
*/
|
|
120
|
-
private function register_function( $twig, $name, $callback ) {
|
|
119
|
+
private function register_function( $twig, $name, $callback ): \Twig\Environment {
|
|
121
120
|
$twig->addFunction( new \Twig\TwigFunction( $name, $callback ) );
|
|
122
121
|
|
|
123
122
|
return $twig;
|
|
@@ -126,13 +125,13 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
126
125
|
/**
|
|
127
126
|
* Register a Twig filter.
|
|
128
127
|
*
|
|
129
|
-
* @param \
|
|
128
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
130
129
|
* @param string $name The name of the function.
|
|
131
130
|
* @param callable $callback The callback function.
|
|
132
131
|
*
|
|
133
|
-
* @return \
|
|
132
|
+
* @return \Twig\Environment
|
|
134
133
|
*/
|
|
135
|
-
private function register_filter( $twig, $name, $callback ) {
|
|
134
|
+
private function register_filter( \Twig\Environment $twig, string $name, callable $callback ): \Twig\Environment {
|
|
136
135
|
$twig->addFilter( new \Twig\TwigFilter( $name, $callback ) );
|
|
137
136
|
|
|
138
137
|
return $twig;
|
|
@@ -141,13 +140,13 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
141
140
|
/**
|
|
142
141
|
* Register a Twig test.
|
|
143
142
|
*
|
|
144
|
-
* @param \
|
|
143
|
+
* @param \Twig\Environment $twig The Twig environment.
|
|
145
144
|
* @param string $name The name of the function.
|
|
146
145
|
* @param callable $callback The callback function.
|
|
147
146
|
*
|
|
148
|
-
* @return \
|
|
147
|
+
* @return \Twig\Environment
|
|
149
148
|
*/
|
|
150
|
-
private function register_test( $twig, $name, $callback ) {
|
|
149
|
+
private function register_test( \Twig\Environment $twig, string $name, callable $callback ): \Twig\Environment {
|
|
151
150
|
$twig->addTest( new \Twig\TwigTest( $name, $callback ) );
|
|
152
151
|
|
|
153
152
|
return $twig;
|
|
@@ -159,10 +158,10 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
159
158
|
* @param string $menu_name The menu name.
|
|
160
159
|
* @return string
|
|
161
160
|
*/
|
|
162
|
-
public function get_nav_menu( $menu_name ) {
|
|
161
|
+
public function get_nav_menu( string $menu_name ): string {
|
|
163
162
|
$context = Timber::context();
|
|
164
163
|
|
|
165
|
-
return $context['menus'][$menu_name];
|
|
164
|
+
return $context['menus'][$menu_name] ?? '';
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
/**
|
|
@@ -170,19 +169,23 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
170
169
|
*
|
|
171
170
|
* @param object $post The post object.
|
|
172
171
|
*/
|
|
173
|
-
public function timber_set_product( $post ) {
|
|
174
|
-
|
|
172
|
+
public function timber_set_product( object $post ): void {
|
|
173
|
+
WoocommerceHelpers::timber_set_product( $post );
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
/**
|
|
178
177
|
* Prepare post classnames to follow ITCSS structure.
|
|
179
178
|
*
|
|
180
|
-
* @param string $classes The post classes.
|
|
181
|
-
* @param string
|
|
179
|
+
* @param ?string $classes The post classes.
|
|
180
|
+
* @param string $prefix The prefix e.g. c-post--.
|
|
182
181
|
*
|
|
183
182
|
* @return string
|
|
184
183
|
*/
|
|
185
|
-
public function post_classes( $classes, $prefix = 'c-post--' ) {
|
|
184
|
+
public function post_classes( ?string $classes, string $prefix = 'c-post--' ): string {
|
|
185
|
+
if ( empty( $classes ) ) {
|
|
186
|
+
return '';
|
|
187
|
+
}
|
|
188
|
+
|
|
186
189
|
$classnames = explode( ' ', $classes );
|
|
187
190
|
$classnames = array_map(
|
|
188
191
|
function ( $classname ) use ( $prefix ) {
|
|
@@ -201,7 +204,7 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
201
204
|
*
|
|
202
205
|
* @return array
|
|
203
206
|
*/
|
|
204
|
-
public function slider_prepare_params( $params ) {
|
|
207
|
+
public function slider_prepare_params( array $params ): array {
|
|
205
208
|
$defaults = array(
|
|
206
209
|
'type' => 'default',
|
|
207
210
|
);
|
|
@@ -269,16 +272,18 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
269
272
|
* @param string $image_size Image size.
|
|
270
273
|
* @param array $attrs Image attributes.
|
|
271
274
|
*
|
|
272
|
-
* @return string
|
|
275
|
+
* @return string
|
|
273
276
|
*/
|
|
274
|
-
public function get_responsive_image( $image_id, $image_size = 'medium', $attrs = array() ) {
|
|
277
|
+
public function get_responsive_image( int $image_id, string $image_size = 'medium', array $attrs = array() ): string {
|
|
275
278
|
return ImageHelpers::get_responsive_image( $image_id, $image_size, $attrs );
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
/**
|
|
279
282
|
* Display comments template - the comments and the form.
|
|
283
|
+
*
|
|
284
|
+
* @return string
|
|
280
285
|
*/
|
|
281
|
-
public function comments_template() {
|
|
286
|
+
public function comments_template(): string {
|
|
282
287
|
return CommentsHelpers::comments_template();
|
|
283
288
|
}
|
|
284
289
|
|
|
@@ -290,16 +295,16 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
290
295
|
*
|
|
291
296
|
* @return string
|
|
292
297
|
*/
|
|
293
|
-
public function bem( $name = '', ...$modifiers ) {
|
|
298
|
+
public function bem( string $name = '', mixed ...$modifiers ): string {
|
|
294
299
|
return ThemeHelpers::bem( $name, ...$modifiers );
|
|
295
300
|
}
|
|
296
301
|
|
|
297
302
|
/**
|
|
298
303
|
* Display breadcrumbs. Requires Yoast plugin.
|
|
299
304
|
*
|
|
300
|
-
* @return
|
|
305
|
+
* @return string
|
|
301
306
|
*/
|
|
302
|
-
public function breadcrumbs() {
|
|
307
|
+
public function breadcrumbs(): string {
|
|
303
308
|
return YoastHelpers::breadcrumbs();
|
|
304
309
|
}
|
|
305
310
|
|
|
@@ -308,9 +313,9 @@ class Twig implements InstanceInterface, HooksInterface {
|
|
|
308
313
|
*
|
|
309
314
|
* @param array $args
|
|
310
315
|
*
|
|
311
|
-
* @return
|
|
316
|
+
* @return string
|
|
312
317
|
*/
|
|
313
|
-
public function get_icon( $args ) {
|
|
318
|
+
public function get_icon( array $args ): string {
|
|
314
319
|
return Components::get_icon( $args );
|
|
315
320
|
}
|
|
316
321
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-styles.js
CHANGED
|
@@ -11,8 +11,9 @@ class BlocksStyles {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
unregisterBlockStyles() {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
unregisterBlockStyle('core/button', ['fill', 'outline']);
|
|
16
|
+
}, 10);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
registerBlockStyles() {
|