generator-chisel 1.0.0 → 2.0.0-alpha.1
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 +33 -0
- package/README.md +2 -4
- package/bin/chisel.js +2 -22
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.twig-cs-fixer.php +13 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/404.php +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/README.md +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_666eb7f38d2ed.json +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/acf-json/group_66d5a4ebb41cd.json +148 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/archive.php +38 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/fonts/quicksand-700.woff2 +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/fonts/quicksand-regular.woff2 +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/loader.svg +17 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/minus.svg +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons/plus.svg +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/images/chisel.png +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/author.php +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Acf.php +191 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfBlocks.php +190 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AcfSync.php +230 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Ajax.php +161 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/AjaxEnpoints.php +103 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Assets.php +607 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Blocks.php +270 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ChiselCache.php +87 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Components.php +208 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/CustomPostTypes.php +442 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedImage.php +24 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedPost.php +42 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedProduct.php +41 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/ExtendedTerm.php +13 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Helpers.php +135 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/RegisterBlocks.php +273 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Sidebars.php +110 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Site.php +123 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Theme.php +277 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Twig.php +241 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/Woocommerce.php +183 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/classes/interfaces/Instance.php +31 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.lock +2180 -0
- package/lib/commands/create/creators/{wp → app}/chisel-starter-theme/footer.php +11 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +47 -0
- package/lib/commands/create/creators/{wp → app}/chisel-starter-theme/header.php +3 -1
- package/lib/commands/create/creators/{wp/chisel-starter-theme/index.chisel-tpl.php → app/chisel-starter-theme/index.php} +15 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/languages/.gitkeep +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/lint-staged.config.mjs +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +40 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/page.php +25 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/patterns/cta.php +39 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +63 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/screenshot.jpg +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/search.php +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/single.php +19 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/accordion-item.js +79 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/edit.js +80 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/editor.scss +24 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/index.js +44 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/save.js +40 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/style.scss +81 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/view.js +146 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/acf-json/group_66462c70b851f.json +131 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/block.json +28 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/script.js +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/slider.twig +26 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks-acf/slider/style.scss +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/_index.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +24 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +70 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_buttons.scss +104 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_icon.scss +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_index.scss +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_link.scss +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_media.scss +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_px-to-rem.scss +21 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_screen-readers.scss +30 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_theme.scss +57 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_width.scss +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/acf-sync.js +26 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin/acf.js +27 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/admin.js +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/app.js +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/blog.js +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-attributes.js +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks-styles.js +124 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/blocks.js +55 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/components/BlockEditSelector.js +39 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/components/RenderAppender.js +32 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor.js +2 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/login.js +29 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/load-more.js +93 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +99 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +385 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/utils.js +43 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/acf-sync.scss +64 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/admin.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-button.scss +62 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-details.scss +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-gallery.scss +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-latest-comments.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-latest-posts.scss +82 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-media-text.scss +34 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-post-date.scss +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-post-title.scss +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-query.scss +65 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-search.scss +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core-spacer.scss +33 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/blocks/_core.scss +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_badge.scss +24 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +67 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_content.scss +42 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_footer.scss +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_header.scss +34 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_icon.scss +19 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_load-more.scss +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +804 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav.scss +305 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_pagination.scss +34 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_post-card.scss +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_post.scss +22 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_posts-items.scss +90 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_select2.scss +45 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_sidebar.scss +20 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +122 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/editor.scss +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_form.scss +346 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_html.scss +17 -0
- package/lib/commands/create/creators/app/{template → chisel-starter-theme}/src/styles/elements/_images.scss +2 -12
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_link.scss +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_shared.scss +44 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/elements/_table.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/generic/_reset.scss +84 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/login.scss +156 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/main.scss +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_grid.scss +30 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_layout.scss +62 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/objects/_wrapper.scss +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/utilities/_sr.scss +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/.gitkeep +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/vendor/_gravity-forms.scss +140 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/widgets/_nav-menu.scss +20 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/widgets/_widget.scss +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_account.scss +25 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_archive.scss +32 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_btn.scss +49 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_cart.scss +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_checkout.scss +53 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_general.scss +68 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_notices.scss +60 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_product-item.scss +29 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woo/_product.scss +24 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/woocommerce.scss +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_block-edit-selector.scss +47 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_block-sidebar.scss +30 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-button.scss +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-pagination.scss +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_core-spacer.scss +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_editor.scss +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_render-appender.scss +33 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/wp-editor/_swiper-sliders.scss +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +481 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/404.twig +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/archive.twig +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/author.twig +11 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +43 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav-item.twig +21 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +27 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/page-title.twig +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/pagination.twig +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +26 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +0 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/slider.twig +12 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +36 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/page-plugin.twig +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/page.twig +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/logo.twig +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/pagination.twig +70 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/partials/the-title.twig +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-blog.twig +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/sidebar-woocommerce.twig +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/single-password.twig +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +56 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/archive-product.twig +83 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +51 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/linked-products.twig +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/single-product.twig +76 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/webpack.config.js +6 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/woocommerce.php +57 -0
- package/lib/commands/create/creators/app/index.js +28 -75
- package/lib/commands/create/creators/app/template/.gitignore.chisel-tpl +2 -2
- package/lib/commands/create/creators/init.js +2 -4
- package/lib/commands/create/creators/wp/index.js +28 -36
- package/lib/commands/create/creators/wp-plugins/index.js +3 -1
- package/lib/commands/create/creators/wp-plugins/plugins.json +0 -1
- package/lib/commands/create/packages-versions.js +3 -9
- package/lib/commands/create/priorities.js +0 -3
- package/lib/utils/sort-package.js +3 -9
- package/package.json +3 -9
- package/lib/commands/create/creators/app/template/.browserslistrc.chisel-tpl +0 -19
- package/lib/commands/create/creators/app/template/.editorconfig +0 -17
- package/lib/commands/create/creators/app/template/.eslintignore +0 -4
- package/lib/commands/create/creators/app/template/.eslintrc.js +0 -25
- package/lib/commands/create/creators/app/template/.prettierignore +0 -4
- package/lib/commands/create/creators/app/template/.stylelintignore +0 -3
- package/lib/commands/create/creators/app/template/babel.config.js +0 -16
- package/lib/commands/create/creators/app/template/chisel.config.chisel-tpl.js +0 -48
- package/lib/commands/create/creators/app/template/package.chisel-tpl.json +0 -43
- package/lib/commands/create/creators/app/template/postcss.config.js +0 -8
- package/lib/commands/create/creators/app/template/prettier.config.js +0 -4
- package/lib/commands/create/creators/app/template/src/scripts/app.chisel-tpl.js +0 -8
- package/lib/commands/create/creators/app/template/src/scripts/modules/greeting.chisel-tpl.js +0 -17
- package/lib/commands/create/creators/app/template/src/styles/components/_btn.scss +0 -60
- package/lib/commands/create/creators/app/template/src/styles/components/_footer.scss +0 -10
- package/lib/commands/create/creators/app/template/src/styles/components/_header.scss +0 -9
- package/lib/commands/create/creators/app/template/src/styles/elements/_blockquote.scss +0 -20
- package/lib/commands/create/creators/app/template/src/styles/elements/_headings.scss +0 -33
- package/lib/commands/create/creators/app/template/src/styles/elements/_html.scss +0 -40
- package/lib/commands/create/creators/app/template/src/styles/elements/_links.scss +0 -12
- package/lib/commands/create/creators/app/template/src/styles/elements/_lists.scss +0 -23
- package/lib/commands/create/creators/app/template/src/styles/elements/_tables.scss +0 -11
- package/lib/commands/create/creators/app/template/src/styles/generic/_box-sizing.scss +0 -20
- package/lib/commands/create/creators/app/template/src/styles/generic/_font-face.scss +0 -8
- package/lib/commands/create/creators/app/template/src/styles/generic/_normalize.scss +0 -5
- package/lib/commands/create/creators/app/template/src/styles/generic/_reset.scss +0 -51
- package/lib/commands/create/creators/app/template/src/styles/generic/_shared.scss +0 -32
- package/lib/commands/create/creators/app/template/src/styles/main.chisel-tpl.scss +0 -13
- package/lib/commands/create/creators/app/template/src/styles/objects/_layout.scss +0 -49
- package/lib/commands/create/creators/app/template/src/styles/objects/_list-bare.scss +0 -13
- package/lib/commands/create/creators/app/template/src/styles/objects/_list-inline.scss +0 -16
- package/lib/commands/create/creators/app/template/src/styles/objects/_media.scss +0 -53
- package/lib/commands/create/creators/app/template/src/styles/objects/_table.scss +0 -26
- package/lib/commands/create/creators/app/template/src/styles/objects/_wrapper.scss +0 -14
- package/lib/commands/create/creators/app/template/src/styles/settings/_global.scss +0 -50
- package/lib/commands/create/creators/app/template/src/styles/tools/_breakpoints.scss +0 -67
- package/lib/commands/create/creators/app/template/src/styles/tools/_clearfix.scss +0 -18
- package/lib/commands/create/creators/app/template/src/styles/tools/_hidden.scss +0 -17
- package/lib/commands/create/creators/app/template/src/styles/utilities/_align.scss +0 -27
- package/lib/commands/create/creators/app/template/src/styles/utilities/_clearfix.scss +0 -11
- package/lib/commands/create/creators/app/template/src/styles/utilities/_hide.scss +0 -28
- package/lib/commands/create/creators/app/template/src/templates/components/footer.chisel-tpl.twig +0 -3
- package/lib/commands/create/creators/app/template/src/templates/components/header.chisel-tpl.twig +0 -3
- package/lib/commands/create/creators/app/template/src/templates/layouts/base.chisel-tpl.twig +0 -42
- package/lib/commands/create/creators/app/template/src/templates/layouts/page.twig +0 -8
- package/lib/commands/create/creators/app/template/stylelint.config.js +0 -3
- package/lib/commands/create/creators/fe/index-styles.css +0 -147
- package/lib/commands/create/creators/fe/index.js +0 -51
- package/lib/commands/create/creators/fe/template/.htmlhintrc +0 -3
- package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html +0 -77
- package/lib/commands/create/creators/fe/template-index/index.chisel-tpl.html.rej +0 -13
- package/lib/commands/create/creators/wp/chisel-starter-theme/.gitignore.chisel-tpl +0 -1
- package/lib/commands/create/creators/wp/chisel-starter-theme/404.chisel-tpl.php +0 -9
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/ChiselExtension.php +0 -14
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/ChiselTwig.php +0 -234
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/DataType.php +0 -27
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/Theme.php +0 -21
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Extensions/Twig.php +0 -137
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Helpers.php +0 -29
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Image.php +0 -29
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Media.php +0 -79
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Performance.php +0 -59
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Post.php +0 -82
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Security.php +0 -30
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Settings.php +0 -38
- package/lib/commands/create/creators/wp/chisel-starter-theme/Chisel/Site.php +0 -50
- package/lib/commands/create/creators/wp/chisel-starter-theme/README.chisel-tpl.md +0 -5
- package/lib/commands/create/creators/wp/chisel-starter-theme/archive.chisel-tpl.php +0 -36
- package/lib/commands/create/creators/wp/chisel-starter-theme/author.chisel-tpl.php +0 -16
- package/lib/commands/create/creators/wp/chisel-starter-theme/functions.php +0 -31
- package/lib/commands/create/creators/wp/chisel-starter-theme/page.chisel-tpl.php +0 -23
- package/lib/commands/create/creators/wp/chisel-starter-theme/screenshot.png +0 -0
- package/lib/commands/create/creators/wp/chisel-starter-theme/search.chisel-tpl.php +0 -14
- package/lib/commands/create/creators/wp/chisel-starter-theme/single.chisel-tpl.php +0 -18
- package/lib/commands/create/creators/wp/chisel-starter-theme/style.chisel-tpl.css +0 -5
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/404.twig +0 -5
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/author.twig +0 -7
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/comment.twig +0 -7
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/main-nav.twig +0 -20
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/tease-post.twig +0 -9
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/components/tease.twig +0 -9
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/index.twig +0 -7
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/page-plugin.twig +0 -7
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/page.twig +0 -10
- package/lib/commands/create/creators/wp/chisel-starter-theme/templates/single.twig +0 -31
- package/lib/commands/create/creators/wp/template/src/styles/components/_comment-form.scss +0 -21
- package/lib/commands/create/creators/wp/template/src/styles/components/_comment.scss +0 -17
- package/lib/commands/create/creators/wp/template/src/styles/components/_main-nav.scss +0 -54
- package/lib/commands/create/creators/wp/template/src/styles/components/_post.scss +0 -36
- package/lib/commands/create/creators/wp/template/wp/.gitignore.chisel-tpl +0 -2
- package/lib/commands/create/creators/wp/template/wp-cli.yml +0 -1
- /package/lib/commands/create/creators/app/{template/src → chisel-starter-theme}/assets/fonts/.keep +0 -0
- /package/lib/commands/create/creators/app/{template/src → chisel-starter-theme}/assets/images/.keep +0 -0
- /package/lib/commands/create/creators/app/{template/src/styles/vendor/.keep → chisel-starter-theme/classes/Comments.php} +0 -0
- /package/lib/commands/create/creators/{fe/template/public/.keep → app/chisel-starter-theme/classes/Yoast.php} +0 -0
- /package/lib/commands/create/creators/app/{template → chisel-starter-theme}/src/styles/elements/_hr.scss +0 -0
- /package/lib/commands/create/creators/{wp/template/wp → app/template}/.htaccess +0 -0
- /package/lib/commands/create/creators/{wp/template/wp → app/template}/wp-config.php +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel;
|
|
4
|
+
|
|
5
|
+
use Timber\Timber;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Blocks related functionalities.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class Blocks extends RegisterBlocks implements Instance {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Chisel blocks category.
|
|
16
|
+
*
|
|
17
|
+
* @var string
|
|
18
|
+
*/
|
|
19
|
+
protected $blocks_category;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Blocks patterns categories.
|
|
24
|
+
*
|
|
25
|
+
* @var array
|
|
26
|
+
*/
|
|
27
|
+
protected $block_patterns_categories = array();
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Blocks twig file base path.
|
|
31
|
+
*
|
|
32
|
+
* @var string
|
|
33
|
+
*/
|
|
34
|
+
protected $blocks_twig_base_path = 'src/blocks/';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Class constructor.
|
|
38
|
+
*/
|
|
39
|
+
private function __construct() {
|
|
40
|
+
$this->set_properties();
|
|
41
|
+
|
|
42
|
+
parent::__construct( 'wp' );
|
|
43
|
+
|
|
44
|
+
$this->action_hooks();
|
|
45
|
+
$this->filter_hooks();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Set properties.
|
|
50
|
+
*/
|
|
51
|
+
public function set_properties() {
|
|
52
|
+
$this->blocks_category = apply_filters( 'chisel_blocks_category', 'chisel-blocks' );
|
|
53
|
+
$this->block_patterns_categories = apply_filters(
|
|
54
|
+
'chisel_block_patterns_categories',
|
|
55
|
+
array(
|
|
56
|
+
'cta' => array(
|
|
57
|
+
'label' => __( 'Call to Action', 'chisel' ),
|
|
58
|
+
'description' => __( 'Call to Action Sections.', 'chisel' ),
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Register action hooks.
|
|
66
|
+
*/
|
|
67
|
+
public function action_hooks() {
|
|
68
|
+
add_action( 'init', array( $this, 'register_blocks' ) );
|
|
69
|
+
add_action( 'after_setup_theme', array( $this, 'blocks_theme_supports' ) );
|
|
70
|
+
add_action( 'init', array( $this, 'register_block_patterns_categories' ) );
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Register filter hooks.
|
|
75
|
+
*/
|
|
76
|
+
public function filter_hooks() {
|
|
77
|
+
add_filter( 'block_categories_all', array( $this, 'block_categories' ) );
|
|
78
|
+
add_filter( 'timber/locations', array( $this, 'tiwg_files_locations' ) );
|
|
79
|
+
add_filter( 'render_block', array( $this, 'render_block' ), 10, 3 );
|
|
80
|
+
|
|
81
|
+
add_filter( 'should_load_separate_core_block_assets', array( $this, 'should_load_separate_core_block_assets' ) );
|
|
82
|
+
add_filter( 'styles_inline_size_limit', array( $this, 'styles_inline_size_limit' ) );
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Register blocks and their assets.
|
|
87
|
+
*/
|
|
88
|
+
public function register_blocks() {
|
|
89
|
+
$this->register_custom_blocks();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Set up theme supports for blocks.
|
|
94
|
+
*/
|
|
95
|
+
public function blocks_theme_supports() {
|
|
96
|
+
add_theme_support( 'wp-block-styles' ); // extra core blocks styles.
|
|
97
|
+
|
|
98
|
+
remove_theme_support( 'core-block-patterns' ); // remove default wp patterns and use only custom ones.
|
|
99
|
+
add_filter( 'should_load_remote_block_patterns', '__return_false' );
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Register custom blocks categories
|
|
104
|
+
*
|
|
105
|
+
* @param array $categories
|
|
106
|
+
*
|
|
107
|
+
* @return array
|
|
108
|
+
*/
|
|
109
|
+
public function block_categories( $categories ) {
|
|
110
|
+
$include = true;
|
|
111
|
+
|
|
112
|
+
foreach ( $categories as $category ) {
|
|
113
|
+
if ( $this->blocks_category === $category['slug'] ) {
|
|
114
|
+
$include = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if ( $include ) {
|
|
119
|
+
// move our category to the top, because we can 😎.
|
|
120
|
+
array_unshift(
|
|
121
|
+
$categories,
|
|
122
|
+
array(
|
|
123
|
+
'slug' => $this->blocks_category,
|
|
124
|
+
'title' => __( 'Chisel Blocks', 'chisel' ),
|
|
125
|
+
'icon' => '<svg width="44" height="44" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.16 44.16"><path d="M22.08,0a22,22,0,0,0-12,3.55.83.83,0,0,0-.25,1.16A.84.84,0,0,0,11,5,20.41,20.41,0,1,1,8.37,7,.84.84,0,1,0,7.23,5.74,22.08,22.08,0,1,0,22.08,0Zm15,12.07a.84.84,0,1,0-1.4.93,16.3,16.3,0,1,1-2.16-2.61.84.84,0,0,0,1.19,0,.85.85,0,0,0,0-1.19,18.14,18.14,0,1,0,2.38,2.88Zm-15-2.86a12.83,12.83,0,0,0-7.65,2.52.85.85,0,0,0-.17,1.18.84.84,0,0,0,1.18.18A11.18,11.18,0,1,1,24.8,32.93.84.84,0,0,0,25,34.59l.2,0A12.87,12.87,0,0,0,22.08,9.21ZM15,30.74A11.19,11.19,0,0,1,13,15.62a.84.84,0,1,0-1.37-1,12.86,12.86,0,0,0,2.36,17.4.84.84,0,0,0,.53.19.86.86,0,0,0,.66-.31A.85.85,0,0,0,15,30.74Z" fill="#2a1468"></path><path d="M28.49,25.69a.85.85,0,0,0-1.18.19,6.46,6.46,0,1,1-1.43-9,.84.84,0,1,0,1-1.36,8.15,8.15,0,1,0,1.8,11.38A.85.85,0,0,0,28.49,25.69Zm-6.41-7a3.43,3.43,0,1,0,3.43,3.43A3.44,3.44,0,0,0,22.08,18.65Zm0,5.17a1.74,1.74,0,1,1,1.74-1.74A1.74,1.74,0,0,1,22.08,23.82Z" fill="#ff6d54"></path></svg>',
|
|
126
|
+
)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return $categories;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Register block patterns categories
|
|
135
|
+
*
|
|
136
|
+
* @return void
|
|
137
|
+
*/
|
|
138
|
+
public function register_block_patterns_categories() {
|
|
139
|
+
if ( ! $this->block_patterns_categories || ! function_exists( 'register_block_pattern_category' ) ) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
foreach ( $this->block_patterns_categories as $slug => $category ) {
|
|
144
|
+
$category['label'] = '[Chisel] ' . $category['label'];
|
|
145
|
+
register_block_pattern_category( 'chisel-block-patterns-' . $slug, $category );
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Add custom Twig files locations.
|
|
151
|
+
*
|
|
152
|
+
* @param array $locations The locations.
|
|
153
|
+
* @return array
|
|
154
|
+
*/
|
|
155
|
+
public function tiwg_files_locations( $locations ) {
|
|
156
|
+
if ( ! is_array( $this->blocks ) || ! $this->blocks ) {
|
|
157
|
+
return $locations;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
foreach ( $this->blocks as $block ) {
|
|
161
|
+
$locations[] = array( $this->blocks_path_src . '/' . $block . '/' );
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return $locations;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Modify blocks content. Add custom classes to all blocks
|
|
169
|
+
*
|
|
170
|
+
* @param string $block_content
|
|
171
|
+
* @param array $block
|
|
172
|
+
* @param object $block_instance WP_Block instance.
|
|
173
|
+
*
|
|
174
|
+
* @return string
|
|
175
|
+
*/
|
|
176
|
+
public function render_block( $block_content, $block, $block_instance ) {
|
|
177
|
+
if ( is_admin() || wp_doing_ajax() || wp_doing_cron() ) {
|
|
178
|
+
return $block_content;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
$custom_classnames = self::get_block_object_classnames( $block['blockName'] );
|
|
182
|
+
|
|
183
|
+
if ( empty( $custom_classnames ) ) {
|
|
184
|
+
return $block_content;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
$processor = new \WP_HTML_Tag_Processor( $block_content );
|
|
188
|
+
$processor->next_tag(); // Get first tag.
|
|
189
|
+
$processor->add_class( $custom_classnames );
|
|
190
|
+
$processor->remove_class( 'is-layout-flow' ); // It overwrites margin styles. Let's get rid of it.
|
|
191
|
+
|
|
192
|
+
return $processor->get_updated_html();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Set inline size limit for the styles. Default wp limit is 20000.
|
|
197
|
+
*
|
|
198
|
+
* @param int $limit
|
|
199
|
+
*
|
|
200
|
+
* @return int
|
|
201
|
+
*/
|
|
202
|
+
public function styles_inline_size_limit( $limit ) {
|
|
203
|
+
$limit = apply_filters( 'chisel_styles_inline_size_limit', 10000 );
|
|
204
|
+
|
|
205
|
+
return $limit;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Should load separate core block assets or in bulk in one block-library css file.
|
|
210
|
+
*
|
|
211
|
+
* @param bool $load
|
|
212
|
+
*
|
|
213
|
+
* @return bool
|
|
214
|
+
*/
|
|
215
|
+
public function should_load_separate_core_block_assets( $load ) {
|
|
216
|
+
$load = apply_filters( 'chisel_load_separate_core_block_assets', false );
|
|
217
|
+
|
|
218
|
+
return $load;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Get block object classnames
|
|
223
|
+
*
|
|
224
|
+
* @param string $block_name
|
|
225
|
+
*
|
|
226
|
+
* @return string
|
|
227
|
+
*/
|
|
228
|
+
public static function get_block_object_classnames( $block_name ) {
|
|
229
|
+
if ( ! $block_name ) {
|
|
230
|
+
return '';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
$block_name_parts = explode( '/', $block_name );
|
|
234
|
+
|
|
235
|
+
if ( empty( $block_name_parts ) || ! isset( $block_name_parts[1] ) ) {
|
|
236
|
+
return '';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return 'c-block c-block--' . $block_name_parts[0] . ' c-block--' . $block_name_parts[1];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Render twig file for a block
|
|
244
|
+
*
|
|
245
|
+
* @param string $block_name
|
|
246
|
+
* @param array $context
|
|
247
|
+
*
|
|
248
|
+
* @return void
|
|
249
|
+
*/
|
|
250
|
+
public static function render_twig_file( $block_name, $context ) {
|
|
251
|
+
$block_name = explode( '/', $block_name );
|
|
252
|
+
$block_name = end( $block_name );
|
|
253
|
+
|
|
254
|
+
$twig_file = self::get_instance()->blocks_twig_base_path . $block_name . '/render.twig';
|
|
255
|
+
Timber::render( $twig_file, $context );
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Get the instance of the class.
|
|
260
|
+
*/
|
|
261
|
+
public static function get_instance() {
|
|
262
|
+
static $instance = null;
|
|
263
|
+
|
|
264
|
+
if ( null === $instance ) {
|
|
265
|
+
$instance = new self();
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return $instance;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel;
|
|
4
|
+
|
|
5
|
+
use Timber\Loader;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Cache related functionalities.
|
|
9
|
+
*
|
|
10
|
+
* @package Chisel
|
|
11
|
+
*/
|
|
12
|
+
class ChiselCache implements Instance {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Cache expiry time.
|
|
16
|
+
*
|
|
17
|
+
* @var int
|
|
18
|
+
*/
|
|
19
|
+
protected $cache_expiry;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Class constructor.
|
|
23
|
+
*/
|
|
24
|
+
private function __construct() {
|
|
25
|
+
$this->set_properties();
|
|
26
|
+
$this->action_hooks();
|
|
27
|
+
$this->filter_hooks();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Set properties.
|
|
32
|
+
*/
|
|
33
|
+
public function set_properties() {
|
|
34
|
+
$this->cache_expiry = apply_filters( 'chisel_cache_expiry', HOUR_IN_SECONDS );
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Register action hooks.
|
|
39
|
+
*/
|
|
40
|
+
public function action_hooks() {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Register filter hooks.
|
|
45
|
+
*/
|
|
46
|
+
public function filter_hooks() {
|
|
47
|
+
add_filter( 'timber/cache/mode', array( $this, 'cache_mode' ) );
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Set Timber cache mode.
|
|
52
|
+
*
|
|
53
|
+
* @param string $cache_mode The cache mode.
|
|
54
|
+
*
|
|
55
|
+
* @return string
|
|
56
|
+
*/
|
|
57
|
+
public function cache_mode( $cache_mode ) {
|
|
58
|
+
// Available cache modes: 'CACHE_NONE', 'CACHE_OBJECT' (WP Object Cache), 'CACHE_TRANSIENT', 'CACHE_SITE_TRANSIENT', 'CACHE_USE_DEFAULT'.
|
|
59
|
+
$cache_mode = Loader::CACHE_USE_DEFAULT;
|
|
60
|
+
|
|
61
|
+
return $cache_mode;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get the cache expiry time.
|
|
66
|
+
*
|
|
67
|
+
* @param int $custom_expiry The custom expiry time.
|
|
68
|
+
*
|
|
69
|
+
* @return int
|
|
70
|
+
*/
|
|
71
|
+
public static function expiry( $custom_expiry = null ) {
|
|
72
|
+
return $custom_expiry ? $custom_expiry : self::get_instance()->cache_expiry;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get the instance of the class.
|
|
77
|
+
*/
|
|
78
|
+
public static function get_instance() {
|
|
79
|
+
static $instance = null;
|
|
80
|
+
|
|
81
|
+
if ( null === $instance ) {
|
|
82
|
+
$instance = new self();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return $instance;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Chisel;
|
|
4
|
+
|
|
5
|
+
use Timber\Timber;
|
|
6
|
+
use Chisel\ChiselCache;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Use this class to get site components.
|
|
10
|
+
*
|
|
11
|
+
* @package Chisel
|
|
12
|
+
*/
|
|
13
|
+
class Components {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The site nav menus.
|
|
17
|
+
*
|
|
18
|
+
* @var array
|
|
19
|
+
*/
|
|
20
|
+
protected static $menus = array();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The logo image html.
|
|
24
|
+
*
|
|
25
|
+
* @var html
|
|
26
|
+
*/
|
|
27
|
+
protected static $logo_image = '';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The sidebar widgets.
|
|
31
|
+
*
|
|
32
|
+
* @var array
|
|
33
|
+
*/
|
|
34
|
+
protected static $sidebar = array();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The footer sidebars.
|
|
38
|
+
*
|
|
39
|
+
* @var array
|
|
40
|
+
*/
|
|
41
|
+
protected static $footer_sidebars = array();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The page / post title.
|
|
45
|
+
*
|
|
46
|
+
* @var string|html
|
|
47
|
+
*/
|
|
48
|
+
protected static $the_title = null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get the site nav menus.
|
|
52
|
+
*
|
|
53
|
+
* @return array
|
|
54
|
+
*/
|
|
55
|
+
public static function get_menus() {
|
|
56
|
+
if ( ! self::$menus ) {
|
|
57
|
+
foreach ( array_keys( get_registered_nav_menus() ) as $menu ) {
|
|
58
|
+
if ( strpos( $menu, 'chisel', 0 ) === false ) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$menu_name = str_replace( 'chisel_', '', $menu );
|
|
63
|
+
|
|
64
|
+
if ( ! has_nav_menu( $menu ) ) {
|
|
65
|
+
$menus[$menu_name] = '';
|
|
66
|
+
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
$menus[$menu_name] = Timber::get_menu( $menu );
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return $menus;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get the site logo.
|
|
79
|
+
*
|
|
80
|
+
* @return string
|
|
81
|
+
*/
|
|
82
|
+
public static function get_logo() {
|
|
83
|
+
$context = Timber::context();
|
|
84
|
+
|
|
85
|
+
if ( ! self::$logo_image ) {
|
|
86
|
+
$logo_id = get_theme_mod( 'custom_logo', 0 );
|
|
87
|
+
|
|
88
|
+
if ( $logo_id ) {
|
|
89
|
+
self::$logo_image = Timber::get_image( $logo_id )->responsive();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
$context['logo_image'] = self::$logo_image;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return Timber::compile(
|
|
96
|
+
'partials/logo.twig',
|
|
97
|
+
$context,
|
|
98
|
+
ChiselCache::expiry( DAY_IN_SECONDS )
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get the sidebar.
|
|
104
|
+
*
|
|
105
|
+
* @param string $sidebar_id The sidebar id.
|
|
106
|
+
*
|
|
107
|
+
* @return array
|
|
108
|
+
*/
|
|
109
|
+
public static function get_sidebar( $sidebar_id = false ) {
|
|
110
|
+
if ( self::$sidebar ) {
|
|
111
|
+
return self::$sidebar;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ( $sidebar_id ) {
|
|
115
|
+
self::$sidebar = Timber::get_widgets( 'chisel-sidebar-' . $sidebar_id );
|
|
116
|
+
return self::$sidebar;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if ( is_singular( 'post' ) ) {
|
|
120
|
+
self::$sidebar = Timber::get_widgets( 'chisel-sidebar-blog' );
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if ( function_exists( 'is_shop' ) && is_shop() ) {
|
|
124
|
+
self::$sidebar = Timber::get_widgets( 'chisel-sidebar-woocommerce' );
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return self::$sidebar;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get the footer sidebars.
|
|
132
|
+
*
|
|
133
|
+
* @return array
|
|
134
|
+
*/
|
|
135
|
+
public static function get_footer_sidebars() {
|
|
136
|
+
if ( self::$footer_sidebars ) {
|
|
137
|
+
return self::$footer_sidebars;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
self::$footer_sidebars = array(
|
|
141
|
+
'columns' => array(),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
$column_class = '';
|
|
145
|
+
|
|
146
|
+
for ( $i = 1; $i <= 4; $i++ ) {
|
|
147
|
+
$footer_widgets = Timber::get_widgets( 'chisel-sidebar-footer-' . $i );
|
|
148
|
+
|
|
149
|
+
if ( $footer_widgets ) {
|
|
150
|
+
self::$footer_sidebars['columns'][] = $footer_widgets;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
switch ( count( self::$footer_sidebars['columns'] ) ) {
|
|
155
|
+
case 4:
|
|
156
|
+
$column_class = 'o-layout__item--3-large';
|
|
157
|
+
break;
|
|
158
|
+
case 3:
|
|
159
|
+
$column_class = 'o-layout__item--4-large';
|
|
160
|
+
break;
|
|
161
|
+
case 2:
|
|
162
|
+
$column_class = 'o-layout__item--6-large';
|
|
163
|
+
break;
|
|
164
|
+
default:
|
|
165
|
+
$column_class = 'o-layout__item--12';
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
self::$footer_sidebars['column_class'] = $column_class;
|
|
170
|
+
|
|
171
|
+
return self::$footer_sidebars;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get the page or post title html based on the acf field value.
|
|
176
|
+
*
|
|
177
|
+
* @param int $post_id
|
|
178
|
+
*
|
|
179
|
+
* @return string|html
|
|
180
|
+
*/
|
|
181
|
+
public static function get_the_title( $post_id ) {
|
|
182
|
+
$context = Timber::context();
|
|
183
|
+
|
|
184
|
+
if ( self::$the_title === null ) {
|
|
185
|
+
$display = Acf::get_field( 'page_title_display', $post_id ) ?: 'show';
|
|
186
|
+
|
|
187
|
+
if ( $display === 'hide' ) {
|
|
188
|
+
self::$the_title = array();
|
|
189
|
+
} else {
|
|
190
|
+
$title = get_the_title( $post_id );
|
|
191
|
+
$sr_only = $display === 'hide-visually' ? 'u-sr-only' : '';
|
|
192
|
+
|
|
193
|
+
self::$the_title = array(
|
|
194
|
+
'class' => sprintf( 'c-title %s', $sr_only ),
|
|
195
|
+
'text' => esc_html( $title ),
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
$context['the_title'] = apply_filters( 'chisel_the_title', self::$the_title, $post_id );
|
|
201
|
+
|
|
202
|
+
return Timber::compile(
|
|
203
|
+
'partials/the-title.twig',
|
|
204
|
+
$context,
|
|
205
|
+
ChiselCache::expiry()
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|