diff --git a/.eslintrc.js b/.eslintrc.js index c9ce0119c..c13bc5930 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,9 +14,50 @@ const eslintConfig = { }, globals: { kt_blocks_params: 'readonly', - kadence_blocks_params: 'writeable', + kadence_blocks_params: 'writable', kt_deregister_params: 'readonly', kadence_blocks_user_params: 'readonly', + kadence_blocks_parallax: 'readonly', + kadence_blocks_form_params: 'readonly', + form_data: 'readonly', + grecaptcha: 'readonly', + kb_adv_form_params: 'readonly', + kadence_video_pop: 'readonly', + kadenceExtensionImagePicker: 'readonly', + kt_blocks_default_size: 'readonly', + kb_glightbox: 'readonly', + AOS: 'readonly', + kadenceHomeParams: 'readonly', + jarallax: 'readonly', + jQuery: 'readonly', + sessionStorage: 'writable', + localStorage: 'writable', + FormData: 'readonly', + location: 'readonly', + FileReader: 'readonly', + Headers: 'readonly', + pagenow: 'readonly', + ENTER: 'readonly', + Splide: 'readonly', + MouseEvent: 'readonly', + countUp: 'readonly', + CustomEvent: 'readonly', + DOMParser: 'readonly', + KadenceAccordion: 'readonly', + Gumshoe: 'readonly', + HTMLElement: 'readonly', + XMLHttpRequest: 'readonly', + Typed: 'readonly', + define: 'readonly', + history: 'writable', + filteredBlockPatterns: 'readable', + onSelectBlockPattern: 'readable', + blockCode: 'readable', + scrollTo: 'readable', + Image: 'readable', + Masonry: 'readable', + IntersectionObserver: 'readable', + getComputedStyle: 'readable', }, rules: { '@wordpress/i18n-text-domain': [ @@ -25,22 +66,23 @@ const eslintConfig = { allowedTextDomain: ['default', 'kadence-blocks', 'kadence-starter-templates'], }, ], + 'import/no-unresolved': [ + 'error', + { + ignore: ['@kadence/icons', '@kadence/components', '@kadence/helpers', '@wordpress/*'], + }, + ], 'import/no-extraneous-dependencies': 'off', - 'import/no-unresolved': 'off', - 'import/named': 'off', 'no-unused-vars': 'off', 'react-hooks/exhaustive-deps': 'off', 'no-shadow': 'off', - '@wordpress/i18n-ellipsis': 'off', 'jsdoc/require-param': 'off', 'no-nested-ternary': 'off', camelcase: 'off', - 'no-undef': 'off', '@wordpress/no-unsafe-wp-apis': 'off', 'react-hooks/rules-of-hooks': 'off', 'no-console': 'off', 'react/jsx-no-target-blank': 'off', - 'no-var': 'off', 'array-callback-return': 'off', 'jsdoc/check-types': 'off', 'jsdoc/check-tag-names': 'off', @@ -49,10 +91,7 @@ const eslintConfig = { eqeqeq: 'off', 'no-unused-expressions': 'off', 'jsx-a11y/no-autofocus': 'off', - '@wordpress/i18n-translator-comments': 'off', 'jsdoc/check-line-alignment': 'off', - 'no-useless-computed-key': 'off', - '@wordpress/no-unused-vars-before-return': 'off', 'react/no-unknown-property': 'off', 'react/jsx-key': 'off', 'jsdoc/check-param-names': 'off', @@ -64,15 +103,21 @@ const eslintConfig = { 'jsx-a11y/no-static-element-interactions': 'off', 'jsx-a11y/aria-role': 'off', 'jsdoc/require-param-type': 'off', - 'jsx-a11y/anchor-is-valid': 'off', 'no-redeclare': 'off', 'import/default': 'off', - '@wordpress/i18n-no-collapsible-whitespace': 'off', 'jsx-a11y/alt-text': 'off', 'no-bitwise': 'off', 'jsdoc/require-returns-check': 'off', '@wordpress/no-global-active-element': 'off', }, + overrides: [ + { + files: ['src/assets/js/**'], + rules: { + 'no-var': 'off', + }, + }, + ], ignorePatterns: [], }; diff --git a/.github/workflows/zip.yml b/.github/workflows/zip.yml index f8f69f6fa..d34de04c5 100644 --- a/.github/workflows/zip.yml +++ b/.github/workflows/zip.yml @@ -65,7 +65,7 @@ jobs: slack_channel: ${{ needs.set_vars.outputs.slack_channel }} slack_thread: ${{ needs.set_vars.outputs.slack_thread }} secrets: - COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} + COMPOSER_TOKEN: ${{ secrets.GH_BOT_TOKEN }} GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }} JENKINS_SECRET: ${{ secrets.ZIP_JENKINS_SECRET }} S3_BUCKET: ${{ secrets.ZIP_S3_BUCKET }} diff --git a/includes/advanced-form/advanced-form-captcha-settings.php b/includes/advanced-form/advanced-form-captcha-settings.php index fc6ccbc64..e5e0482f3 100644 --- a/includes/advanced-form/advanced-form-captcha-settings.php +++ b/includes/advanced-form/advanced-form-captcha-settings.php @@ -119,7 +119,7 @@ private function is_using_kadence_captcha_settings( $attributes ) { } private function is_using_kadence_blocks_settings( $attributes ) { - if ( isset( $attributes['useKbSettings'] ) && $attributes['useKbSettings'] ) { + if ( !isset( $attributes['useKbSettings'] ) || ( isset( $attributes['useKbSettings'] ) && $attributes['useKbSettings'] ) ) { $this->using_kadence_blocks_settings = true; } else { $this->using_kadence_blocks_settings = false; diff --git a/includes/assets/js/gumshoe.min.js b/includes/assets/js/gumshoe.min.js index ec6bf6f47..d77a27f54 100644 --- a/includes/assets/js/gumshoe.min.js +++ b/includes/assets/js/gumshoe.min.js @@ -4,4 +4,4 @@ * (c) 2019 Chris Ferdinandi * MIT License * http://github.com/cferdinandi/gumshoe - */(function(a,b){"function"==typeof define&&define.amd?define([],function(){return b(a)}):"object"==typeof exports?module.exports=b(a):a.Gumshoe=b(a)})("undefined"==typeof global?"undefined"==typeof window?this:window:global,function(a){"use strict";const b={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},c=function(){const a={};return Array.prototype.forEach.call(arguments,function(b){for(const c in b){if(!b.hasOwnProperty(c))return;a[c]=b[c]}}),a},d=function(a,b,c){if(c.settings.events){const d=new CustomEvent(a,{bubbles:!0,cancelable:!0,detail:c});b.dispatchEvent(d)}},e=function(a){let b=0;if(a.offsetParent)for(;a;)b+=a.offsetTop,a=a.offsetParent;return 0<=b?b:0},f=function(a){a&&a.sort(function(a,b){const c=e(a.content),d=e(b.content);return c=h())},l=function(a,b){return!!(k()&&j(a.content,b,!0))},m=function(a,b){const c=a[a.length-1];if(l(c,b))return c;for(let c=a.length-1;0<=c;c--)if(j(a[c].content,b))return a[c]};var n=function(a,b){if(b.nested&&a.parentNode){const c=a.parentNode.closest("li");c&&(c.classList.remove(b.nestedClass),n(c,b))}};const o=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.remove(b.navClass),a.content.classList.remove(b.contentClass),n(c,b),d("gumshoeDeactivate",c,{link:a.nav,content:a.content,settings:b}))}};var p=function(a,b){if(b.nested){const c=a.parentNode.closest("li");c&&(c.classList.add(b.nestedClass),p(c,b))}};const q=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.add(b.navClass),a.content.classList.add(b.contentClass),p(c,b),d("gumshoeActivate",c,{link:a.nav,content:a.content,settings:b}))}};return function(d,e){const g={};let h,i,j,k,l;g.setup=function(){h=document.querySelectorAll(d),i=[],Array.prototype.forEach.call(h,function(a){const b=document.getElementById(decodeURIComponent(a.hash.substr(1)));b&&i.push({nav:a,content:b})}),f(i)},g.detect=function(){const a=m(i,l);return a?void(j&&a.content===j.content||(o(j,l),q(a,l),j=a)):void(j&&(o(j,l),j=null))};const n=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(g.detect)},p=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(function(){f(i),g.detect()})};g.destroy=function(){j&&o(j,l),a.removeEventListener("scroll",n,!1),l.reflow&&a.removeEventListener("resize",p,!1),i=null,h=null,j=null,k=null,l=null};return function(){l=c(b,e||{}),g.setup(),g.detect(),a.addEventListener("scroll",n,!1),l.reflow&&a.addEventListener("resize",p,!1)}(),g}}); \ No newline at end of file + */(function(a,b){"function"==typeof define&&define.amd?define([],function(){return b(a)}):"object"==typeof exports?module.exports=b(a):a.Gumshoe=b(a)})("undefined"==typeof global?"undefined"==typeof window?this:window:global,function(a){"use strict";const b={navClass:"active",contentClass:"active",nested:!1,nestedClass:"active",offset:0,reflow:!1,events:!0},c=function(){const a={};return Array.prototype.forEach.call(arguments,function(b){for(const c in b){if(!b.hasOwnProperty(c))return;a[c]=b[c]}}),a},d=function(a,b,c){if(c.settings.events){const d=new CustomEvent(a,{bubbles:!0,cancelable:!0,detail:c});b.dispatchEvent(d)}},e=function(a){let b=0;if(a.offsetParent)for(;a;)b+=a.offsetTop,a=a.offsetParent;return 0<=b?b:0},f=function(a){a&&a.sort(function(a,b){const c=e(a.content),d=e(b.content);return c=h())},l=function(a,b){return!!(k()&&j(a.content,b,!0))},m=function(a,b){const c=a[a.length-1];if(l(c,b))return c;for(let c=a.length-1;0<=c;c--)if(j(a[c].content,b))return a[c]};var n=function(a,b){if(b.nested&&a.parentNode){const c=a.parentNode.closest("li");c&&(c.classList.remove(b.nestedClass),n(c,b))}};const o=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.remove(b.navClass),a.content.classList.remove(b.contentClass),n(c,b),d("gumshoeDeactivate",c,{link:a.nav,content:a.content,settings:b}))}};var p=function(a,b){if(b.nested){const c=a.parentNode.closest("li");c&&(c.classList.add(b.nestedClass),p(c,b))}};const q=function(a,b){if(a){const c=a.nav.closest("li");c&&(c.classList.add(b.navClass),a.content.classList.add(b.contentClass),p(c,b),d("gumshoeActivate",c,{link:a.nav,content:a.content,settings:b}))}};return function(d,e){const g={};let h,i,j,k,l;g.setup=function(){h=document.querySelectorAll(d),i=[],Array.prototype.forEach.call(h,function(a){const b=document.getElementById(decodeURIComponent(a.hash.substr(1)));b&&i.push({nav:a,content:b})}),f(i)},g.detect=function(){const a=m(i,l);return a?void(j&&a.content===j.content||(o(j,l),q(a,l),j=a)):void(j&&(o(j,l),j=null))};const n=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(g.detect)},p=function(b){k&&a.cancelAnimationFrame(k),k=a.requestAnimationFrame(function(){f(i),g.detect()})};g.destroy=function(){j&&o(j,l),a.removeEventListener("scroll",n,!1),l.reflow&&a.removeEventListener("resize",p,!1),i=null,h=null,j=null,k=null,l=null};return function(){l=c(b,e||{}),g.setup(),g.detect(),a.addEventListener("scroll",n,!1),l.reflow&&a.addEventListener("resize",p,!1)}(),g}}); \ No newline at end of file diff --git a/includes/assets/js/kb-header-block.min.js b/includes/assets/js/kb-header-block.min.js index bbe42332f..9c50b5b24 100644 --- a/includes/assets/js/kb-header-block.min.js +++ b/includes/assets/js/kb-header-block.min.js @@ -1 +1 @@ -class KBHeader{components={};_state;root;rootID;autoTransparentSpacing;sticky;stickyTablet;stickyMobile;transparent;transparentTablet;transparentMobile;stickySection;stickySectionTablet;stickySectionMobile;activeSize="mobile";lastScrollTop=0;activeOffsetTop=0;shrinkMain=!1;shrinkMainHeight=0;shrinkMainHeightTablet=0;shrinkMainHeightMobile=0;shrinkStartHeight=0;currentTopPosition=0;anchorOffset=0;activeHeader;isSticking=!1;isTransparent=!1;constructor(a,b={}){this.root="string"==typeof a?document.querySelector(a):a,this.rootID="aaa",this.autoTransparentSpacing="1"===this.root.dataset?.autoTransparentSpacing,this.sticky="1"==this.root.dataset?.sticky,this.stickyTablet="1"==this.root.dataset?.stickyTablet,this.stickyMobile="1"==this.root.dataset?.stickyMobile,this.transparent="1"==this.root.dataset?.transparent,this.transparentTablet="1"==this.root.dataset?.transparentTablet,this.transparentMobile="1"==this.root.dataset?.transparentMobile,this.stickySection=this.root.dataset?.stickySection,this.stickySectionTablet=this.root.dataset?.stickySectionTablet,this.stickySectionMobile=this.root.dataset?.stickySectionMobile,this.shrinkMain="1"===this.root.dataset?.shrinkMain,this.shrinkMainHeight=this.root.dataset?.shrinkMainHeight,this.shrinkMainHeightTablet=this.root.dataset?.shrinkMainHeightTablet,this.shrinkMainHeightMobile=this.root.dataset?.shrinkMainHeightMobile,this.revealScrollUp="1"===this.root.dataset?.revealScrollUp,this._state="CREATED",this.transparent&&this.autoTransparentSpacing&&this.initAutoTransparentSpacing(),(this.sticky||this.stickyTablet||this.stickyMobile)&&this.stickySection&&this.initStickyHeader();var c=new Event("MOUNTED",{bubbles:!0});c.qlID=this.rootID,this.root.dispatchEvent(c),this._state="IDLE"}initAutoTransparentSpacing(){const a=this;this.setAutoTransparentSpacing(),document.onresize=a.setAutoTransparentSpacing}setAutoTransparentSpacing(){const a=this.getHeight(),b=this.root.nextElementSibling;b.style.paddingTop=a+"px"}getHeight(){return this.root.querySelector("div").clientHeight}initStickyHeader(){this.activeHeader=this.root.querySelector(".wp-block-kadence-header-desktop"),parseInt(kadenceHeaderConfig.breakPoints.desktop){this.updateSticky("updateActive").bind(this)})}respondToVisibility(a,b){var c={root:document.documentElement},d=new IntersectionObserver(a=>{a.forEach(a=>{b(0this.lastScrollTop)var n=Math.floor(Math.floor(this.activeOffsetTop)-Math.floor(e)+Math.floor(startHeight));else var n=Math.floor(this.activeOffsetTop-e);var o=this.activeHeader.querySelectorAll(".custom-logo"),p=this.activeHeader.querySelector(".wp-block-kadence-header-row-center");if(this.shrinkStartHeight||(this.shrinkStartHeight=p.offsetHeight),window.scrollY<=n){if(p.style.height=this.shrinkStartHeight+"px",p.style.minHeight=this.shrinkStartHeight+"px",p.style.maxHeight=this.shrinkStartHeight+"px",o)for(let a=0;an){var q=Math.max(m,this.shrinkStartHeight-(window.scrollY-(this.activeOffsetTop-e)));if(p.style.height=q+"px",p.style.minHeight=q+"px",p.style.maxHeight=q+"px",o)for(let a=0;athis.lastScrollTop,s=Math.floor(this.anchorOffset+g);if(f<=this.anchorOffset-e)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else if(f<=s){if(r)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else{this.activeHeader.classList.remove("item-hidden-above");var t=f-this.anchorOffset+e;this.activeHeader.style.top=t+"px",this.currentTopPosition=t,this.setStickyChanged(!0)}}else if(r){this.activeHeader.classList.add("item-hidden-above");var t=f-this.anchorOffset+e-g;this.activeHeader.style.top=t+"px",this.currentTopPosition=t,this.setStickyChanged(!0)}else{this.activeHeader.classList.remove("item-hidden-above");var t=f-this.anchorOffset+e;this.activeHeader.style.top=t+"px",this.currentTopPosition=t,this.setStickyChanged(!0)}this.activeHeader.style.top=t+"px"}else{var s=Math.floor(this.anchorOffset-e);if(f<=s)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else{var t=f-this.anchorOffset+e;this.activeHeader.style.top=t+"px",this.currentTopPosition=t,this.setStickyChanged(!0)}}this.lastScrollTop=f,window.scrollY==s?(this.activeHeader.classList.add("item-is-fixed"),this.activeHeader.classList.add("item-at-start"),this.activeHeader.classList.remove("item-is-stuck"),l.classList.add("child-is-fixed"),document.body.classList.add("header-is-fixed")):window.scrollY>s?this.revealScrollUp?window.scrollY{window.KBHeaderBlocks=[];var a=document.querySelectorAll(".wp-block-kadence-header");for(let c=0;c{this.updateSticky("updateActive").bind(this)})}respondToVisibility(a,b){var c={root:document.documentElement},d=new IntersectionObserver(a=>{a.forEach(a=>{b(0this.lastScrollTop)var m=Math.floor(Math.floor(this.activeOffsetTop)-Math.floor(b)+Math.floor(l));else var m=Math.floor(this.activeOffsetTop-b);var n=this.activeHeader.querySelectorAll(".custom-logo"),o=this.activeHeader.querySelector(".wp-block-kadence-header-row-center");if(this.shrinkStartHeight||(this.shrinkStartHeight=o.offsetHeight),window.scrollY<=m){if(o.style.height=this.shrinkStartHeight+"px",o.style.minHeight=this.shrinkStartHeight+"px",o.style.maxHeight=this.shrinkStartHeight+"px",n)for(let a=0;am){var p=Math.max(l,this.shrinkStartHeight-(window.scrollY-(this.activeOffsetTop-b)));if(o.style.height=p+"px",o.style.minHeight=p+"px",o.style.maxHeight=p+"px",n)for(let a=0;athis.lastScrollTop,r=Math.floor(this.anchorOffset+d);if(c<=this.anchorOffset-b)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else if(c<=r){if(q)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else{this.activeHeader.classList.remove("item-hidden-above");var s=c-this.anchorOffset+b;this.activeHeader.style.top=s+"px",this.currentTopPosition=s,this.setStickyChanged(!0)}}else if(q){this.activeHeader.classList.add("item-hidden-above");var s=c-this.anchorOffset+b-d;this.activeHeader.style.top=s+"px",this.currentTopPosition=s,this.setStickyChanged(!0)}else{this.activeHeader.classList.remove("item-hidden-above");var s=c-this.anchorOffset+b;this.activeHeader.style.top=s+"px",this.currentTopPosition=s,this.setStickyChanged(!0)}this.activeHeader.style.top=s+"px"}else{var r=Math.floor(this.anchorOffset-b);if(c<=r)this.activeHeader.style.top=0,this.currentTopPosition=0,this.setStickyChanged(!1);else{var s=c-this.anchorOffset+b;this.activeHeader.style.top=s+"px",this.currentTopPosition=s,this.setStickyChanged(!0)}}this.lastScrollTop=c,window.scrollY==r?(this.activeHeader.classList.add("item-is-fixed"),this.activeHeader.classList.add("item-at-start"),this.activeHeader.classList.remove("item-is-stuck"),k.classList.add("child-is-fixed"),document.body.classList.add("header-is-fixed")):window.scrollY>r?this.revealScrollUp?window.scrollY{window.KBHeaderBlocks=[];var a=document.querySelectorAll(".wp-block-kadence-header");for(let c=0;c .kt-blocks-carousel-init");this.bootstrapSliders(c)},bootstrapSliders(a){if(a&&0!==a.length)for(let c=0;c=e?0:Math.floor(e/2),arrows:!!(1{const d=parseInt(a[c]);return Number.isNaN(d)||c.includes("sliderGap")?"true"===a[c]||"false"===a[c]?{...b,[c]:JSON.parse(a[c])}:{...b,[c]:a[c]}:{...b,[c]:d}},{})},createSplideElements(a){const b=a.children.length;for(const b of a.children)b.classList.add("splide__slide"),b.classList.contains("last")&&b.classList.remove("last");const c=document.createElement("div");c.classList.add("splide__track");const d=document.createElement("div");return d.classList.add("splide__list"),d.innerHTML=a.innerHTML,c.innerHTML=d.outerHTML,a.innerHTML=c.outerHTML,a.classList.add("splide"),b},getSplideOptions(a){const b=1===a.sliderScroll&&1,c={trimSpace:!0,drag:!0,perPage:a.columnsXxl||1,type:a.sliderFade?"fade":"loop",easing:a.sliderAnimSpeed&&1e3 .kt-blocks-carousel-init");this.bootstrapSliders(c)},bootstrapSliders(a){if(a&&0!==a.length)for(let c=0;c=e?0:Math.floor(e/2),arrows:!!(1{const d=parseInt(a[c]);return Number.isNaN(d)||c.includes("sliderGap")?"true"===a[c]||"false"===a[c]?{...b,[c]:JSON.parse(a[c])}:{...b,[c]:a[c]}:{...b,[c]:d}},{})},createSplideElements(a){const b=a.children.length;for(const b of a.children)b.classList.add("splide__slide"),b.classList.contains("last")&&b.classList.remove("last");const c=document.createElement("div");c.classList.add("splide__track");const d=document.createElement("div");return d.classList.add("splide__list"),d.innerHTML=a.innerHTML,c.innerHTML=d.outerHTML,a.innerHTML=c.outerHTML,a.classList.add("splide"),b},getSplideOptions(a){const b=1===a.sliderScroll&&1,c={trimSpace:!0,drag:!0,perPage:a.columnsXxl||1,type:a.sliderFade?"fade":"loop",easing:a.sliderAnimSpeed&&1e3{if(!a.classList.contains("initialized")){a.querySelectorAll(":scope > .kt-tabs-title-list").forEach(a=>{a.setAttribute("role","tablist")}),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content").forEach(a=>{a.setAttribute("role","tabpanel"),a.setAttribute("aria-hidden","true")}),a.querySelectorAll(":scope > .kt-tabs-title-list li a").forEach(b=>{const c=b.parentElement,d=c.getAttribute("id"),e=c.classList.contains("kt-tab-title-active"),f=c.classList.contains("kt-tabs-accordion-title"),g=b.getAttribute("data-tab"),h=a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+g);f?b.setAttribute("aria-selected",!!e):(h.setAttribute("aria-labelledby",d),c.setAttribute("role","presentation"),b.setAttribute("role","tab"),b.setAttribute("aria-controls",d),b.setAttribute("tabindex",e?"0":"-1")),h.setAttribute("aria-hidden",e?"false":"true"),e&&(h.style.display="block")}),a.querySelectorAll(":scope > .kt-tabs-title-list li").forEach(a=>{a.addEventListener("keydown",function(b){switch(b.which){case 37:a.previousElementSibling?a.previousElementSibling.querySelector("a").click():a.parentElement.querySelector("li:last-of-type > a").click();break;case 39:a.nextElementSibling?a.nextElementSibling.querySelector("a").click():a.parentElement.querySelector("li:first-of-type > a").click()}})});const b=new Event("resize");window.dispatchEvent(b);const c=a.querySelectorAll(".kt-tabs-title-list li a");c.forEach(a=>{a.addEventListener("click",function(b){b.preventDefault();const c=a.getAttribute("data-tab"),d=a.closest(".kt-tabs-wrap");window.KBTabs.setActiveTab(d,c)})}),a.classList.contains("kt-create-accordion")&&a.querySelectorAll(":scope > .kt-tabs-title-list .kt-title-item").forEach(a=>{const b=a.querySelector("a").getAttribute("data-tab"),c=a.classList,d=a.closest(".kt-tabs-wrap"),e=d.querySelector(":scope > .kt-tabs-content-wrap"),f=window.document.createElement("div");f.className=[...c].concat(["kt-tabs-accordion-title","kt-tabs-accordion-title-"+b]).join(" "),f.innerHTML=a.innerHTML,e.insertBefore(f,e.querySelector(":scope > .kt-inner-tab-"+b)),e.querySelector(":scope > .kt-tabs-accordion-title-"+b+" a").removeAttribute("role"),e.querySelector(":scope > .kt-tabs-accordion-title-"+b+" a").removeAttribute("tabindex")});const d=a.querySelectorAll(".kt-tabs-accordion-title a");d.forEach(a=>{const b=a.closest(".kt-create-accordion")?.dataset?.noAllowMultipleOpen;a.addEventListener("click",function(c){window.KBTabs.setActiveAccordion(c,a,b)})}),a.classList.add("initialized")}}),window.KBTabs.setActiveWithHash()},setActiveWithHash(){if(""==window.location.hash)return;const a=window.document.querySelector(window.location.hash+".kt-title-item");if(!a)return;const b=window.document.querySelector("#"+window.location.hash.substring(1)),c=b.querySelector("a").getAttribute("data-tab"),d=b.closest(".kt-tabs-wrap");window.KBTabs.setActiveTab(d,c),window.KBTabs.isMobileSize()&&d.classList.contains("kt-tabs-mobile-layout-accordion")||window.KBTabs.isTabletSize()&&d.classList.contains("kt-tabs-tablet-layout-accordion")?d.querySelector(".kt-tabs-content-wrap > .kt-tabs-accordion-title.kt-tabs-accordion-title-"+c).scrollIntoView({behavior:"smooth"}):d.classList.contains("kt-tabs-layout-vtabs")&&d.querySelector(".kt-tabs-content-wrap").scrollIntoView({behavior:"smooth"})},isMobileSize(){return 767>=window.innerWidth},isTabletSize(){return 767=window.innerWidth},setActiveAccordion(a,b,c){a.preventDefault();const d=b.getAttribute("data-tab"),e=b.parentElement,f=b.closest(".kt-tabs-wrap"),g=f.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+d);if(e.classList.contains("kt-tab-title-active")?(f.classList.remove("kt-active-tab-"+d),e.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),g.style.display="none"):(f.classList.add("kt-active-tab-"+d),e.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),g.style.display="block"),c){const a=f.querySelectorAll(".kt-tabs-accordion-title a");a.forEach(a=>{const b=a.getAttribute("data-tab"),c=a.parentElement,e=f.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b);b!=d&&(c.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),e.style.display="none")})}const h=new Event("resize");window.dispatchEvent(h);const i=new Event("kadence-tabs-open");window.dispatchEvent(i)},setActiveTab(a,b,c=!0){const d=a.querySelector(":scope > .kt-tabs-title-list > li.kt-tab-title-active a"),e=a.querySelector(":scope > .kt-tabs-title-list > li.kt-tab-title-active");e.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),d.setAttribute("tabindex","-1"),d.setAttribute("aria-selected","false"),a.className=a.className.replace(/\bkt-active-tab-\S+/g,"kt-active-tab-"+b);const f=a.querySelector(":scope > .kt-tabs-title-list > li.kt-title-item-"+b+" a"),g=a.querySelector(":scope > .kt-tabs-title-list > li.kt-title-item-"+b);g.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),f.setAttribute("tabindex","0"),f.setAttribute("aria-selected","true"),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content").forEach(a=>{a.style.display="none"});const h=a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b);h.style.display="block",c&&f.focus(),window.KBTabs.setAriaAttributesForTabs(a,b);const i=new Event("resize");window.dispatchEvent(i);const j=new Event("kadence-tabs-open");window.dispatchEvent(j)},setAriaAttributesForTabs(a,b){a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content:not(.kt-inner-tab-"+b+")").forEach(a=>a.setAttribute("aria-hidden","true")),a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b).setAttribute("aria-hidden","false"),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tabs-accordion-title:not(.kt-tabs-accordion-title-"+b+")").forEach(a=>{a.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false")});const c=a.querySelector(":scope >.kt-tabs-content-wrap > .kt-tabs-accordion-title.kt-tabs-accordion-title-"+b);c&&(c.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),c.setAttribute("tabindex","0"),c.setAttribute("aria-selected","true"))},init(){console.log(1),window.KBTabs.setupTabs(),window.addEventListener("hashchange",window.KBTabs.setActiveWithHash,!1)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",window.KBTabs.init):window.KBTabs.init(),document.addEventListener("kb-query-loaded",window.KBTabs.init)})(); \ No newline at end of file +(function(){"use strict";window.KBTabs={setupTabs(){const a=document.querySelectorAll(".kt-tabs-wrap");a.forEach(a=>{if(!a.classList.contains("initialized")){a.querySelectorAll(":scope > .kt-tabs-title-list").forEach(a=>{a.setAttribute("role","tablist")}),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content").forEach(a=>{a.setAttribute("role","tabpanel"),a.setAttribute("aria-hidden","true")}),a.querySelectorAll(":scope > .kt-tabs-title-list li a").forEach(b=>{const c=b.parentElement,d=c.getAttribute("id"),e=c.classList.contains("kt-tab-title-active"),f=c.classList.contains("kt-tabs-accordion-title"),g=b.getAttribute("data-tab"),h=a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+g);f?b.setAttribute("aria-selected",!!e):(h.setAttribute("aria-labelledby",d),c.setAttribute("role","presentation"),b.setAttribute("role","tab"),b.setAttribute("aria-controls",d),b.setAttribute("tabindex",e?"0":"-1")),h.setAttribute("aria-hidden",e?"false":"true"),e&&(h.style.display="block")}),a.querySelectorAll(":scope > .kt-tabs-title-list li").forEach(a=>{a.addEventListener("keydown",function(b){switch(b.which){case 37:a.previousElementSibling?a.previousElementSibling.querySelector("a").click():a.parentElement.querySelector("li:last-of-type > a").click();break;case 39:a.nextElementSibling?a.nextElementSibling.querySelector("a").click():a.parentElement.querySelector("li:first-of-type > a").click()}})});const b=new Event("resize");window.dispatchEvent(b);const c=a.querySelectorAll(".kt-tabs-title-list li a");c.forEach(a=>{a.addEventListener("click",function(b){b.preventDefault();const c=a.getAttribute("data-tab"),d=a.closest(".kt-tabs-wrap");window.KBTabs.setActiveTab(d,c)})}),a.classList.contains("kt-create-accordion")&&a.querySelectorAll(":scope > .kt-tabs-title-list .kt-title-item").forEach(a=>{const b=a.querySelector("a").getAttribute("data-tab"),c=a.classList,d=a.closest(".kt-tabs-wrap"),e=d.querySelector(":scope > .kt-tabs-content-wrap"),f=window.document.createElement("div");f.className=[...c].concat(["kt-tabs-accordion-title","kt-tabs-accordion-title-"+b]).join(" "),f.innerHTML=a.innerHTML,e.insertBefore(f,e.querySelector(":scope > .kt-inner-tab-"+b)),e.querySelector(":scope > .kt-tabs-accordion-title-"+b+" a").removeAttribute("role"),e.querySelector(":scope > .kt-tabs-accordion-title-"+b+" a").removeAttribute("tabindex")});const d=a.querySelectorAll(".kt-tabs-accordion-title a");d.forEach(a=>{const b=a.closest(".kt-create-accordion")?.dataset?.noAllowMultipleOpen;a.addEventListener("click",function(c){window.KBTabs.setActiveAccordion(c,a,b)})}),a.classList.add("initialized")}}),window.KBTabs.setActiveWithHash()},setActiveWithHash(){if(""==window.location.hash)return;const a=window.document.querySelector(window.location.hash+".kt-title-item");if(!a)return;const b=window.document.querySelector("#"+window.location.hash.substring(1)),c=b.querySelector("a").getAttribute("data-tab"),d=b.closest(".kt-tabs-wrap");window.KBTabs.setActiveTab(d,c),window.KBTabs.isMobileSize()&&d.classList.contains("kt-tabs-mobile-layout-accordion")||window.KBTabs.isTabletSize()&&d.classList.contains("kt-tabs-tablet-layout-accordion")?d.querySelector(".kt-tabs-content-wrap > .kt-tabs-accordion-title.kt-tabs-accordion-title-"+c).scrollIntoView({behavior:"smooth"}):d.classList.contains("kt-tabs-layout-vtabs")&&d.querySelector(".kt-tabs-content-wrap").scrollIntoView({behavior:"smooth"})},isMobileSize(){return 767>=window.innerWidth},isTabletSize(){return 767=window.innerWidth},setActiveAccordion(a,b,c){a.preventDefault();const d=b.getAttribute("data-tab"),e=b.parentElement,f=b.closest(".kt-tabs-wrap"),g=f.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+d);if(e.classList.contains("kt-tab-title-active")?(f.classList.remove("kt-active-tab-"+d),e.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),g.style.display="none"):(f.classList.add("kt-active-tab-"+d),e.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),g.style.display="block"),c){const a=f.querySelectorAll(".kt-tabs-accordion-title a");a.forEach(a=>{const b=a.getAttribute("data-tab"),c=a.parentElement,e=f.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b);b!=d&&(c.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),e.style.display="none")})}const h=new Event("resize");window.dispatchEvent(h);const i=new Event("kadence-tabs-open");window.dispatchEvent(i)},setActiveTab(a,b,c=!0){const d=a.querySelector(":scope > .kt-tabs-title-list > li.kt-tab-title-active a"),e=a.querySelector(":scope > .kt-tabs-title-list > li.kt-tab-title-active");e.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),d.setAttribute("tabindex","-1"),d.setAttribute("aria-selected","false"),a.className=a.className.replace(/\bkt-active-tab-\S+/g,"kt-active-tab-"+b);const f=a.querySelector(":scope > .kt-tabs-title-list > li.kt-title-item-"+b+" a"),g=a.querySelector(":scope > .kt-tabs-title-list > li.kt-title-item-"+b);g.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),f.setAttribute("tabindex","0"),f.setAttribute("aria-selected","true"),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content").forEach(a=>{a.style.display="none"});const h=a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b);h.style.display="block",c&&f.focus(),window.KBTabs.setAriaAttributesForTabs(a,b);const i=new Event("resize");window.dispatchEvent(i);const j=new Event("kadence-tabs-open");window.dispatchEvent(j)},setAriaAttributesForTabs(a,b){a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tab-inner-content:not(.kt-inner-tab-"+b+")").forEach(a=>a.setAttribute("aria-hidden","true")),a.querySelector(":scope > .kt-tabs-content-wrap > .kt-inner-tab-"+b).setAttribute("aria-hidden","false"),a.querySelectorAll(":scope > .kt-tabs-content-wrap > .kt-tabs-accordion-title:not(.kt-tabs-accordion-title-"+b+")").forEach(a=>{a.classList.replace("kt-tab-title-active","kt-tab-title-inactive"),a.setAttribute("tabindex","-1"),a.setAttribute("aria-selected","false")});const c=a.querySelector(":scope >.kt-tabs-content-wrap > .kt-tabs-accordion-title.kt-tabs-accordion-title-"+b);c&&(c.classList.replace("kt-tab-title-inactive","kt-tab-title-active"),c.setAttribute("tabindex","0"),c.setAttribute("aria-selected","true"))},init(){window.KBTabs.setupTabs(),window.addEventListener("hashchange",window.KBTabs.setActiveWithHash,!1)}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",window.KBTabs.init):window.KBTabs.init(),document.addEventListener("kb-query-loaded",window.KBTabs.init)})(); \ No newline at end of file diff --git a/includes/blocks/class-kadence-blocks-image-block.php b/includes/blocks/class-kadence-blocks-image-block.php index dcb7c5225..73bfa2faf 100644 --- a/includes/blocks/class-kadence-blocks-image-block.php +++ b/includes/blocks/class-kadence-blocks-image-block.php @@ -321,6 +321,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) { return $css->css_output(); } + /** * Build HTML for dynamic blocks * @@ -340,6 +341,9 @@ public function build_html( $attributes, $unique_id, $content, $block_instance ) $content = str_replace( 'alt=""', 'alt="' . esc_attr( $alt ) . '"', $content ); } } + if ( strpos( $content, 'kb-tooltip-hidden-content') !== false ) { + $this->enqueue_script( 'kadence-blocks-tippy' ); + } return $content; } @@ -356,8 +360,9 @@ public function register_scripts() { return; } wp_register_script( 'kadence-blocks-' . $this->block_name, KADENCE_BLOCKS_URL . 'includes/assets/js/kb-image-block.min.js', array(), KADENCE_BLOCKS_VERSION, true ); + wp_register_script( 'kadence-blocks-popper', KADENCE_BLOCKS_URL . 'includes/assets/js/popper.min.js', array(), KADENCE_BLOCKS_VERSION, true ); + wp_register_script( 'kadence-blocks-tippy', KADENCE_BLOCKS_URL . 'includes/assets/js/kb-tippy.min.js', array( 'kadence-blocks-popper' ), KADENCE_BLOCKS_VERSION, true ); } - } Kadence_Blocks_Image_Block::get_instance(); diff --git a/includes/blocks/class-kadence-blocks-navigation-block.php b/includes/blocks/class-kadence-blocks-navigation-block.php index 19d5b9813..2d90d2cf7 100644 --- a/includes/blocks/class-kadence-blocks-navigation-block.php +++ b/includes/blocks/class-kadence-blocks-navigation-block.php @@ -304,18 +304,24 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De * @return mixed */ public function build_html( $attributes, $unique_id, $content, $block_instance ) { - $nav_block = get_post( $attributes['id'] ); + $nav_block = null; + $in_template_preview = isset($attributes['templateKey']) && $attributes['templateKey']; - if ( ! $nav_block || 'kadence_navigation' !== $nav_block->post_type ) { - return ''; - } + //If this is a templated navigation placeholder, we're going to skip a bunch of the normal logic and checks + if ( ! $in_template_preview ) { + $nav_block = get_post( $attributes['id'] ); - if ( 'publish' !== $nav_block->post_status || ! empty( $nav_block->post_password ) ) { - return ''; + if ( ! $nav_block || 'kadence_navigation' !== $nav_block->post_type ) { + return ''; + } + + if ( 'publish' !== $nav_block->post_status || ! empty( $nav_block->post_password ) ) { + return ''; + } } // Prevent a nav block from being rendered inside itself. - if ( isset( self::$seen_refs[ $attributes['id'] ] ) ) { + if ( isset( self::$seen_refs[ $attributes['id'] ] ) && ! $attributes['templateKey'] ) { // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent // is set in `wp_debug_mode()`. $is_debug = WP_DEBUG && WP_DEBUG_DISPLAY; @@ -330,8 +336,15 @@ public function build_html( $attributes, $unique_id, $content, $block_instance ) $nav_attributes = $this->get_attributes_with_defaults_cpt( $attributes['id'], 'kadence_navigation', '_kad_navigation_' ); $nav_attributes = json_decode( json_encode( $nav_attributes ), true ); - // Remove the advanced nav block so it doesn't try and render. - $content = preg_replace( '//', '', $nav_block->post_content ); + if ( ! $in_template_preview ) { + // Remove the advanced nav block so it doesn't try and render. + $content = preg_replace( '//', '', $nav_block->post_content ); + } else { + $content = $this->applyTemplateKeyBlocks($attributes); + $nav_attributes['orientation'] = str_contains( $attributes['templateKey'], 'vertical' ) ? 'vertical' : 'horizontal'; + $nav_attributes['orientationTablet'] = str_contains( $attributes['templateKey'], 'vertical' ) ? 'vertical' : 'horizontal'; + $nav_attributes['orientationMobile'] = str_contains( $attributes['templateKey'], 'vertical' ) ? 'vertical' : 'horizontal'; + } $content = str_replace( '', '', $content ); $content = str_replace( '', '', $content ); $content = str_replace( '', '', $content ); @@ -446,6 +459,63 @@ public function build_html( $attributes, $unique_id, $content, $block_instance ) ); } + /** + * Generates content to replace actual blocks for templated navigation placeholders. + * This should match the templated blocks created in the editor for the same template keys + * + * @param array $attributes The database attribtues. + */ + public function applyTemplateKeyBlocks( $attributes ) { + if ( isset($attributes['templateKey']) && $attributes['templateKey'] ) { + switch ($attributes['templateKey']) { + case 'long': + return ' + + + + + + + + + '; + break; + case 'long-vertical': + return ' + + + + + + + + + '; + break; + case 'short': + return ' + + + + + + '; + break; + + default: + return ' + + + + + + '; + break; + } + } + return ''; + } + /** * Registers scripts and styles. */ diff --git a/includes/blocks/class-kadence-blocks-navigation-link-block.php b/includes/blocks/class-kadence-blocks-navigation-link-block.php index dcaa8eb40..fcb786aea 100644 --- a/includes/blocks/class-kadence-blocks-navigation-link-block.php +++ b/includes/blocks/class-kadence-blocks-navigation-link-block.php @@ -487,9 +487,9 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De // $css->set_selector( '.header-navigation[class*="header-navigation-dropdown-animation-fade"] #menu-item-' . $item->ID . '.kadence-menu-mega-enabled > .sub-menu' ); // $css->add_property( 'margin-left', '-' . ( $data['mega_menu_custom_width'] ? floor( $data['mega_menu_custom_width'] / 2 ) : '400' ) . 'px' ); - } else if ($sized_attributes['megaMenuWidth'] === 'full') { + } else if ($sized_attributes['megaMenuWidth'] === 'full' || $sized_attributes['megaMenuWidth'] === '') { //this is handled by a seperate js file - } else if ($sized_attributes['megaMenuWidth'] === 'container' || $sized_attributes['megaMenuWidth'] === '') { + } else if ($sized_attributes['megaMenuWidth'] === 'container' ) { $css->set_selector( '.wp-block-kadence-navigation .menu-container ul.menu .wp-block-kadence-navigation-link' . $unique_id ); @@ -558,9 +558,9 @@ public function build_html( $attributes, $unique_id, $content, $block_instance ) $has_icon = $nav_link_attributes['mediaType'] == 'icon' && ! empty( $nav_link_attributes['mediaIcon'][0]['icon'] ); $has_image = $nav_link_attributes['mediaType'] == 'image' && ! empty( $nav_link_attributes['mediaImage'][0]['url'] ); - $mega_menu_width_class = 'kadence-menu-mega-width-' . ( $nav_link_attributes['megaMenuWidth'] ? $nav_link_attributes['megaMenuWidth'] : 'container' ); - $mega_menu_width_class_tablet = 'kadence-menu-mega-width-tablet-' . ( $nav_link_attributes['megaMenuWidthTablet'] ? $nav_link_attributes['megaMenuWidthTablet'] : 'container' ); - $mega_menu_width_class_mobile = 'kadence-menu-mega-width-mobile-' . ( $nav_link_attributes['megaMenuWidthMobile'] ? $nav_link_attributes['megaMenuWidthMobile'] : 'container' ); + $mega_menu_width_class = 'kadence-menu-mega-width-' . ( $nav_link_attributes['megaMenuWidth'] ? $nav_link_attributes['megaMenuWidth'] : 'full' ); + $mega_menu_width_class_tablet = 'kadence-menu-mega-width-tablet-' . ( $nav_link_attributes['megaMenuWidthTablet'] ? $nav_link_attributes['megaMenuWidthTablet'] : 'full' ); + $mega_menu_width_class_mobile = 'kadence-menu-mega-width-mobile-' . ( $nav_link_attributes['megaMenuWidthMobile'] ? $nav_link_attributes['megaMenuWidthMobile'] : 'full' ); $wrapper_classes = array(); $wrapper_classes[] = 'wp-block-kadence-navigation-link' . $unique_id; diff --git a/includes/blocks/class-kadence-blocks-show-more-block.php b/includes/blocks/class-kadence-blocks-show-more-block.php index 17d54318c..71241ba41 100644 --- a/includes/blocks/class-kadence-blocks-show-more-block.php +++ b/includes/blocks/class-kadence-blocks-show-more-block.php @@ -124,6 +124,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) { $css->add_property( 'max-height', 'none' ); $css->add_property( '-webkit-mask-image', 'none' ); $css->add_property( 'mask-image', 'none' ); + $css->add_property( 'overflow-y', 'unset' ); $css->set_selector( '.kb-block-show-more-container' . $unique_id . '.kb-smc-open > .wp-block-kadence-advancedbtn .kt-btn-wrap:nth-child(1), .kb-block-show-more-container' . $unique_id . '.kb-smc-open > .wp-block-kadence-advancedbtn .wp-block-kadence-singlebtn:nth-of-type(1)' ); $css->add_property( 'display', 'none' ); diff --git a/includes/class-kadence-blocks-prebuilt-library.php b/includes/class-kadence-blocks-prebuilt-library.php index cb52939c3..75cfb3286 100644 --- a/includes/class-kadence-blocks-prebuilt-library.php +++ b/includes/class-kadence-blocks-prebuilt-library.php @@ -503,7 +503,7 @@ public function prebuilt_connection_info_ajax_callback() { if ( ! empty( $final_data['name'] ) ) { wp_send_json( $final_data ); } - wp_send_json( esc_html__( 'No Connection data', 'kadence-blocks' ) ); + wp_send_json( esc_html__( 'No Connection data available', 'kadence-blocks' ) ); } die; } diff --git a/includes/header/class-kadence-header-cpt.php b/includes/header/class-kadence-header-cpt.php index b38e69180..e8f157f07 100644 --- a/includes/header/class-kadence-header-cpt.php +++ b/includes/header/class-kadence-header-cpt.php @@ -39,6 +39,9 @@ public function __construct() { add_action( 'init', array( $this, 'register_meta' ), 20 ); add_filter( 'user_has_cap', array( $this, 'filter_post_type_user_caps' ) ); + // Define the form post gutenberg template. + add_action( 'init', array( $this, 'form_gutenberg_template' ) ); + if( is_admin() ) { if ( class_exists( 'Cpt_To_Template' ) ) { new Cpt_To_Template( $this->post_type ); @@ -47,6 +50,19 @@ public function __construct() { } + /** + * Add filters for element content output. + */ + public function form_gutenberg_template() { + $post_type_object = get_post_type_object( $this->post_type ); + $post_type_object->template = array( + array( + 'kadence/header', + ), + ); + $post_type_object->template_lock = 'all'; + } + /** * Registers the header post type. */ @@ -79,7 +95,7 @@ public function register_post_type() { 'public' => false, 'has_archive' => false, 'show_ui' => true, - 'show_in_menu' => true, + 'show_in_menu' => 'kadence-blocks', 'show_in_admin_bar' => false, 'show_in_rest' => true, 'rewrite' => false, diff --git a/includes/header/img/onboarding.png b/includes/header/img/onboarding.png new file mode 100644 index 000000000..0b5ac3176 Binary files /dev/null and b/includes/header/img/onboarding.png differ diff --git a/includes/navigation/class-kadence-navigation-cpt.php b/includes/navigation/class-kadence-navigation-cpt.php index 2bdf86470..94a04213d 100644 --- a/includes/navigation/class-kadence-navigation-cpt.php +++ b/includes/navigation/class-kadence-navigation-cpt.php @@ -31,6 +31,9 @@ public function __construct() { add_action( 'init', array( $this, 'register_meta' ), 20 ); add_filter( 'user_has_cap', array( $this, 'filter_post_type_user_caps' ) ); + // Define the form post gutenberg template. + add_action( 'init', array( $this, 'form_gutenberg_template' ) ); + if( is_admin() ) { if ( class_exists( 'Cpt_To_Template' ) ) { new Cpt_To_Template( $this->post_type ); @@ -38,6 +41,20 @@ public function __construct() { } } + /** + * Add filters for element content output. + */ + public function form_gutenberg_template() { + $post_type_object = get_post_type_object( $this->post_type ); + $post_type_object->template = array( + array( + 'kadence/navigation', + ), + ); + $post_type_object->template_lock = 'all'; + } + + /** * Registers the form post type. */ @@ -56,28 +73,28 @@ public function register_post_type() { 'labels' => array( 'name' => _x( 'Kadence Navigation', 'post type general name', 'kadence-blocks' ), 'singular_name' => _x( 'Kadence Navigation', 'post type singular name', 'kadence-blocks' ), - 'add_new' => __( 'Add New Kadence Navigation Menu', 'kadence-blocks' ), - 'add_new_item' => __( 'Add New Kadence Navigation Menu', 'kadence-blocks' ), - 'new_item' => __( 'New Kadence Navigation Menu', 'kadence-blocks' ), - 'edit_item' => __( 'Edit Kadence Navigation Menu', 'kadence-blocks' ), - 'view_item' => __( 'View Kadence Navigation Menu', 'kadence-blocks' ), - 'all_items' => __( 'Kadence Navigation Menus', 'kadence-blocks' ), - 'search_items' => __( 'Search Kadence Navigation Menus', 'kadence-blocks' ), - 'parent_item_colon' => __( 'Parent Kadence Navigation Menu:', 'kadence-blocks' ), - 'not_found' => __( 'No Kadence Navigation Menu found.', 'kadence-blocks' ), - 'not_found_in_trash' => __( 'No Kadence Navigation Menu found in Trash.', 'kadence-blocks' ), - 'archives' => __( 'Kadence Navigation Menu archives', 'kadence-blocks' ), - 'insert_into_item' => __( 'Insert into Kadence Navigation Menu', 'kadence-blocks' ), - 'uploaded_to_this_item' => __( 'Uploaded to this Kadence Navigation Menu', 'kadence-blocks' ), - 'filter_items_list' => __( 'Filter Kadence Navigation Menu list', 'kadence-blocks' ), - 'items_list_navigation' => __( 'Kadence Navigation Menus list navigation', 'kadence-blocks' ), - 'items_list' => __( 'Kadence Navigation Menus list', 'kadence-blocks' ), + 'add_new' => __( 'Add New Kadence Navigation', 'kadence-blocks' ), + 'add_new_item' => __( 'Add New Kadence Navigation', 'kadence-blocks' ), + 'new_item' => __( 'New Kadence Navigation', 'kadence-blocks' ), + 'edit_item' => __( 'Edit Kadence Navigation', 'kadence-blocks' ), + 'view_item' => __( 'View Kadence Navigation', 'kadence-blocks' ), + 'all_items' => __( 'Kadence Navigations', 'kadence-blocks' ), + 'search_items' => __( 'Search Kadence Navigations', 'kadence-blocks' ), + 'parent_item_colon' => __( 'Parent Kadence Navigation:', 'kadence-blocks' ), + 'not_found' => __( 'No Kadence Navigation found.', 'kadence-blocks' ), + 'not_found_in_trash' => __( 'No Kadence Navigation found in Trash.', 'kadence-blocks' ), + 'archives' => __( 'Kadence Navigation archives', 'kadence-blocks' ), + 'insert_into_item' => __( 'Insert into Kadence Navigation', 'kadence-blocks' ), + 'uploaded_to_this_item' => __( 'Uploaded to this Kadence Navigation', 'kadence-blocks' ), + 'filter_items_list' => __( 'Filter Kadence Navigation list', 'kadence-blocks' ), + 'items_list_navigation' => __( 'Kadence Navigation list navigation', 'kadence-blocks' ), + 'items_list' => __( 'Kadence Navigation list', 'kadence-blocks' ), ), - 'description' => __( 'Kadence Navigation menus that can be inserted into your site.', 'kadence-blocks' ), + 'description' => __( 'Kadence Navigations that can be inserted into your site.', 'kadence-blocks' ), 'public' => false, 'has_archive' => false, 'show_ui' => true, - 'show_in_menu' => true, + 'show_in_menu' => 'kadence-blocks', 'show_in_admin_bar' => false, 'show_in_rest' => true, 'rewrite' => false, diff --git a/includes/settings/class-kadence-blocks-settings.php b/includes/settings/class-kadence-blocks-settings.php index d3ea79469..3b01e164f 100644 --- a/includes/settings/class-kadence-blocks-settings.php +++ b/includes/settings/class-kadence-blocks-settings.php @@ -789,6 +789,7 @@ public function home_scripts() { 'isNetworkEnabled' => $using_network_enabled, ) ); + wp_set_script_translations( 'admin-kadence-home', 'kadence-blocks' ); wp_enqueue_style( 'kadence-blocks-admin-css', KADENCE_BLOCKS_URL . 'includes/assets/css/admin-dashboard.min.css', array( 'wp-jquery-ui-dialog', 'wp-color-picker' ), KADENCE_BLOCKS_VERSION, 'all' ); wp_enqueue_media(); } @@ -1250,10 +1251,10 @@ public function config_page() { echo '