Changeset 3394502
- Timestamp:
- 11/12/2025 04:22:58 PM (2 months ago)
- Location:
- search-modal-block
- Files:
-
- 12 added
- 6 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/build (added)
-
tags/1.2.0/build/block.json (added)
-
tags/1.2.0/build/index.asset.php (added)
-
tags/1.2.0/build/index.js (added)
-
tags/1.2.0/build/style-index-rtl.css (added)
-
tags/1.2.0/build/style-index.css (added)
-
tags/1.2.0/build/view.asset.php (added)
-
tags/1.2.0/build/view.js (added)
-
tags/1.2.0/package.json (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/search-modal-block.php (added)
-
trunk/build/block.json (modified) (1 diff)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/search-modal-block.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
search-modal-block/trunk/build/block.json
r3305896 r3394502 3 3 "apiVersion": 3, 4 4 "name": "ph/search-modal", 5 "version": "1. 0.1",5 "version": "1.2.0", 6 6 "title": "Search Modal Block", 7 7 "category": "widgets", -
search-modal-block/trunk/build/index.asset.php
r3305896 r3394502 1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => ' fc5cf9595723574bc2b8');1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '52a3876be09813c2ddb6'); -
search-modal-block/trunk/build/index.js
r3305896 r3394502 1 (()=>{"use strict";var e, l={633:(e,l,a)=>{const t=window.wp.blocks;var o=a(609);const r=window.wp.i18n,c=window.wp.element,n=(0,c.forwardRef)((function({icon:e,size:l=24,...a},t){return(0,c.cloneElement)(e,{width:l,height:l,...a,ref:t})})),s=window.wp.primitives;var m=a(848);const i=(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})}),d=window.wp.blockEditor,_=window.wp.components,h=["image"],b={small:"1rem",medium:"1.5rem",large:"2rem",xlarge:"2.5rem"},u=JSON.parse('{"UU":"ph/search-modal"}');(0,t.registerBlockType)(u.UU,{edit:function({attributes:e,setAttributes:l,clientId:a}){const{blockId:t,placeholderText:s,buttonText:m,labelText:u,showLabel:p,iconUrl:k,iconSize:w}=e,x=(0,d.useBlockProps)(),[E,f]=(0,c.useState)(""),[v,y]=(0,c.useState)(!Object.values(b).includes(w)),g=(0,_.__experimentalUseCustomUnits)({availableUnits:["px","em","rem","%"],defaultValues:{px:24,em:1.5,rem:1.5,"%":100}});(0,c.useEffect)((()=>{t||l({blockId:a})}),[a,t,l]);const S=e=>{"custom"===e?y(!0):(y(!1),l({iconSize:b[e]}))},T={width:w,height:w},B=(()=>{for(const[e,l]of Object.entries(b))if(l===w)return e;return"custom"})();return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(d.InspectorControls,null,(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,r.__)("Modal Settings","search-modal-block"),resetAll:()=>{l({placeholderText:(0,r.__)("Search…","search-modal-block"),buttonText:(0,r.__)("Search","search-modal-block"),labelText:(0,r.__)("Open search","search-modal-block"),showLabel:!1})}},(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>s!==(0,r.__)("Search…","search-modal-block"),label:(0,r.__)("Placeholder Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>l({placeholderText:(0,r.__)("Search…","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Placeholder Text","search-modal-block"),value:s,onChange:e=>l({placeholderText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>m!==(0,r.__)("Search","search-modal-block"),label:(0,r.__)("Button Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>l({buttonText:(0,r.__)("Search","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Button Text","search-modal-block"),value:m,onChange:e=>l({buttonText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>u!==(0,r.__)("Open search","search-modal-block"),label:(0,r.__)("Label Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>l({labelText:(0,r.__)("Open search","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Label Text","search-modal-block"),value:u,onChange:e=>l({labelText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>!1!==p,label:(0,r.__)("Show Label","search-modal-block"),isShownByDefault:!0,onDeselect:()=>l({showLabel:!1})},(0,o.createElement)(_.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Show Label","search-modal-block"),checked:p,onChange:e=>l({showLabel:e})}))),(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,r.__)("Icon Settings","search-modal-block"),resetAll:()=>{l({iconUrl:"",iconSize:b.medium}),y(!1)}},(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>!!k,label:(0,r.__)("Button Icon","search-modal-block"),isShownByDefault:!0,onDeselect:()=>l({iconUrl:""})},(0,o.createElement)(d.MediaUploadCheck,null,(0,o.createElement)(d.MediaUpload,{onSelect:e=>{e&&e.url?(f(""),l({iconUrl:e.url})):f((0,r.__)("Invalid media selection.","search-modal-block"))},allowedTypes:h,value:k,render:({open:e})=>(0,o.createElement)(_.Button,{onClick:e,variant:"secondary"},k?(0,r.__)("Replace Icon","search-modal-block"):(0,r.__)("Add Custom Icon","search-modal-block"))})),k&&(0,o.createElement)(_.Button,{onClick:()=>l({iconUrl:""}),variant:"",isDestructive:!0,style:{marginTop:"8px"}},(0,r.__)("Remove Icon","search-modal-block")),E&&(0,o.createElement)("p",{className:"components-notice is-error"},E)),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>w!==b.medium,label:(0,r.__)("Icon Size","search-modal-block"),isShownByDefault:!0,onDeselect:()=>{l({iconSize:b.medium}),y(!1)}},(0,o.createElement)("div",{className:"search-modal-icon-size-control"},(0,o.createElement)(_.ButtonGroup,{style:{marginBottom:"8px"}},(0,o.createElement)(_.Button,{isPrimary:"small"===B,isSecondary:"small"!==B,onClick:()=>S("small")},(0,r.__)("S","search-modal-block")),(0,o.createElement)(_.Button,{isPrimary:"medium"===B,isSecondary:"medium"!==B,onClick:()=>S("medium")},(0,r.__)("M","search-modal-block")),(0,o.createElement)(_.Button,{isPrimary:"large"===B,isSecondary:"large"!==B,onClick:()=>S("large")},(0,r.__)("L","search-modal-block")),(0,o.createElement)(_.Button,{isPrimary:"xlarge"===B,isSecondary:"xlarge"!==B,onClick:()=>S("xlarge")},(0,r.__)("XL","search-modal-block")),(0,o.createElement)(_.Button,{isPrimary:"custom"===B,isSecondary:"custom"!==B,onClick:()=>S("custom")},(0,r.__)("Custom","search-modal-block"))),v&&(0,o.createElement)(_.__experimentalUnitControl,{label:(0,r.__)("Custom Size","search-modal-block"),labelPosition:"edge",value:w,onChange:e=>l({iconSize:e}),units:g}))))),(0,o.createElement)("div",{...x},(0,o.createElement)("button",{className:"wp-block-ph-search-modal__button"},k?(0,o.createElement)("img",{src:k,alt:(0,r.__)("Search","search-modal-block"),className:"wp-block-ph-search-modal__custom-icon",style:T}):(0,o.createElement)(n,{icon:i,style:T}))))},save:function({attributes:e}){const{blockId:l,placeholderText:a,buttonText:t,labelText:r,showLabel:c,iconUrl:s,iconSize:m}=e,_=d.useBlockProps.save(),h={width:m,height:m};return(0,o.createElement)("div",{..._},(0,o.createElement)("button",{className:"wp-block-ph-search-modal__button","data-micromodal-trigger":l,"aria-label":r},s?(0,o.createElement)("img",{src:s,alt:r,className:"wp-block-ph-search-modal__custom-icon",style:h}):(0,o.createElement)(n,{icon:i,style:h})),(0,o.createElement)("div",{className:"modal wp-block-ph-search-modal__fade",id:l,"aria-hidden":"true"},(0,o.createElement)("div",{className:"wp-block-ph-search-modal__overlay",tabIndex:"-1","data-micromodal-close":!0},(0,o.createElement)("div",{className:"wp-block-ph-search-modal__container",role:"dialog","aria-modal":"true","aria-labelledby":`${l}-title`},(0,o.createElement)("header",{className:"wp-block-ph-search-modal__header"},(0,o.createElement)("button",{className:"wp-block-ph-search-modal__close-button","aria-label":r,"data-micromodal-close":!0})),(0,o.createElement)("main",{className:"wp-block-ph-search-modal__content",id:`${l}-content`},(0,o.createElement)("form",{method:"GET",className:"wp-block-ph-search-modal__form wp-block-search",action:"/"},(0,o.createElement)("label",{className:c?"":"screen-reader-text",htmlFor:`${l}-input`},r),(0,o.createElement)("div",{className:"wp-block-ph-search-modal__form-controls"},(0,o.createElement)("input",{id:`${l}-input`,type:"text",name:"s",className:"wp-block-ph-search-modal__form-input wp-block-search__input",placeholder:a,required:!0}),(0,o.createElement)("div",{className:"wp-block-button"},(0,o.createElement)("button",{type:"submit",className:"wp-block-ph-search-modal__form-button wp-block-button__link",style:{cursor:"pointer"}},t)))))))))}})},20:(e,l,a)=>{var t=a(609),o=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};l.jsx=function(e,l,a){var t,s={},m=null,i=null;for(t in void 0!==a&&(m=""+a),void 0!==l.key&&(m=""+l.key),void 0!==l.ref&&(i=l.ref),l)r.call(l,t)&&!n.hasOwnProperty(t)&&(s[t]=l[t]);if(e&&e.defaultProps)for(t in l=e.defaultProps)void 0===s[t]&&(s[t]=l[t]);return{$$typeof:o,type:e,key:m,ref:i,props:s,_owner:c.current}}},848:(e,l,a)=>{e.exports=a(20)},609:e=>{e.exports=window.React}},a={};function t(e){var o=a[e];if(void 0!==o)return o.exports;var r=a[e]={exports:{}};return l[e](r,r.exports,t),r.exports}t.m=l,e=[],t.O=(l,a,o,r)=>{if(!a){var c=1/0;for(i=0;i<e.length;i++){a=e[i][0],o=e[i][1],r=e[i][2];for(var n=!0,s=0;s<a.length;s++)(!1&r||c>=r)&&Object.keys(t.O).every((e=>t.O[e](a[s])))?a.splice(s--,1):(n=!1,r<c&&(c=r));if(n){e.splice(i--,1);var m=o();void 0!==m&&(l=m)}}return l}r=r||0;for(var i=e.length;i>0&&e[i-1][2]>r;i--)e[i]=e[i-1];e[i]=[a,o,r]},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={57:0,350:0};t.O.j=l=>0===e[l];var l=(l,a)=>{var o,r,c=a[0],n=a[1],s=a[2],m=0;if(c.some((l=>0!==e[l]))){for(o in n)t.o(n,o)&&(t.m[o]=n[o]);if(s)var i=s(t)}for(l&&l(a);m<c.length;m++)r=c[m],t.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return t.O(i)},a=self.webpackChunksearch_modal_block=self.webpackChunksearch_modal_block||[];a.forEach(l.bind(null,0)),a.push=l.bind(null,a.push.bind(a))})();var o=t.O(void 0,[350],(()=>t(633)));o=t.O(o)})();1 (()=>{"use strict";var e,a={633:(e,a,l)=>{const t=window.wp.blocks;var o=l(609);const r=window.wp.i18n,c=window.wp.element,n=(0,c.forwardRef)((function({icon:e,size:a=24,...l},t){return(0,c.cloneElement)(e,{width:a,height:a,...l,ref:t})})),s=window.wp.primitives;var m=l(848);const i=(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})}),d=window.wp.blockEditor,_=window.wp.components,h=["image"],b={small:"1rem",medium:"1.5rem",large:"2rem",xlarge:"2.5rem"},u=JSON.parse('{"UU":"ph/search-modal"}');(0,t.registerBlockType)(u.UU,{edit:function({attributes:e,setAttributes:a,clientId:l}){const{blockId:t,placeholderText:s,buttonText:m,labelText:u,showLabel:p,iconUrl:k,iconSize:w}=e,x=(0,d.useBlockProps)(),[E,v]=(0,c.useState)(""),[f,y]=(0,c.useState)(!Object.values(b).includes(w)),g=(0,_.__experimentalUseCustomUnits)({availableUnits:["px","em","rem","%"],defaultValues:{px:24,em:1.5,rem:1.5,"%":100}});(0,c.useEffect)((()=>{t||a({blockId:l})}),[l,t,a]);const T=e=>{"custom"===e?y(!0):(y(!1),a({iconSize:b[e]}))},S={width:w,height:w},C=(()=>{for(const[e,a]of Object.entries(b))if(a===w)return e;return"custom"})();return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(d.InspectorControls,null,(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,r.__)("Modal Settings","search-modal-block"),resetAll:()=>{a({placeholderText:(0,r.__)("Search…","search-modal-block"),buttonText:(0,r.__)("Search","search-modal-block"),labelText:(0,r.__)("Open search","search-modal-block"),showLabel:!1})}},(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>s!==(0,r.__)("Search…","search-modal-block"),label:(0,r.__)("Placeholder Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>a({placeholderText:(0,r.__)("Search…","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Placeholder Text","search-modal-block"),value:s,onChange:e=>a({placeholderText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>m!==(0,r.__)("Search","search-modal-block"),label:(0,r.__)("Button Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>a({buttonText:(0,r.__)("Search","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Button Text","search-modal-block"),value:m,onChange:e=>a({buttonText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>u!==(0,r.__)("Open search","search-modal-block"),label:(0,r.__)("Label Text","search-modal-block"),isShownByDefault:!0,onDeselect:()=>a({labelText:(0,r.__)("Open search","search-modal-block")})},(0,o.createElement)(_.TextControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Label Text","search-modal-block"),value:u,onChange:e=>a({labelText:e})})),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>!1!==p,label:(0,r.__)("Show Label","search-modal-block"),isShownByDefault:!0,onDeselect:()=>a({showLabel:!1})},(0,o.createElement)(_.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,r.__)("Show Label","search-modal-block"),checked:p,onChange:e=>a({showLabel:e})}))),(0,o.createElement)(_.__experimentalToolsPanel,{label:(0,r.__)("Icon Settings","search-modal-block"),resetAll:()=>{a({iconUrl:"",iconSize:b.medium}),y(!1)}},(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>!!k,label:(0,r.__)("Button Icon","search-modal-block"),isShownByDefault:!0,onDeselect:()=>a({iconUrl:""})},(0,o.createElement)(d.MediaUploadCheck,null,(0,o.createElement)(d.MediaUpload,{onSelect:e=>{e&&e.url?(v(""),a({iconUrl:e.url})):v((0,r.__)("Invalid media selection.","search-modal-block"))},allowedTypes:h,value:k,render:({open:e})=>(0,o.createElement)(_.Button,{onClick:e,variant:"secondary"},k?(0,r.__)("Replace Icon","search-modal-block"):(0,r.__)("Add Custom Icon","search-modal-block"))})),k&&(0,o.createElement)(_.Button,{onClick:()=>a({iconUrl:""}),variant:"",isDestructive:!0,style:{marginTop:"8px"}},(0,r.__)("Remove Icon","search-modal-block")),E&&(0,o.createElement)("p",{className:"components-notice is-error"},E)),(0,o.createElement)(_.__experimentalToolsPanelItem,{hasValue:()=>w!==b.medium,label:(0,r.__)("Icon Size","search-modal-block"),isShownByDefault:!0,onDeselect:()=>{a({iconSize:b.medium}),y(!1)}},(0,o.createElement)("div",{className:"search-modal-icon-size-control"},(0,o.createElement)(_.ButtonGroup,{style:{marginBottom:"8px"}},(0,o.createElement)(_.Button,{variant:"small"===C?"primary":"secondary",onClick:()=>T("small")},(0,r.__)("S","search-modal-block")),(0,o.createElement)(_.Button,{variant:"medium"===C?"primary":"secondary",onClick:()=>T("medium")},(0,r.__)("M","search-modal-block")),(0,o.createElement)(_.Button,{variant:"large"===C?"primary":"secondary",onClick:()=>T("large")},(0,r.__)("L","search-modal-block")),(0,o.createElement)(_.Button,{variant:"xlarge"===C?"primary":"secondary",onClick:()=>T("xlarge")},(0,r.__)("XL","search-modal-block")),(0,o.createElement)(_.Button,{variant:"custom"===C?"primary":"secondary",onClick:()=>T("custom")},(0,r.__)("Custom","search-modal-block"))),f&&(0,o.createElement)(_.__experimentalUnitControl,{label:(0,r.__)("Custom Size","search-modal-block"),labelPosition:"edge",value:w,onChange:e=>a({iconSize:e}),units:g}))))),(0,o.createElement)("div",{...x},(0,o.createElement)("button",{className:"wp-block-ph-search-modal__button"},k?(0,o.createElement)("img",{src:k,alt:(0,r.__)("Search","search-modal-block"),className:"wp-block-ph-search-modal__custom-icon",style:S}):(0,o.createElement)(n,{icon:i,style:S}))))},save:function({attributes:e}){const{blockId:a,placeholderText:l,buttonText:t,labelText:c,showLabel:s,iconUrl:m,iconSize:_}=e,h=d.useBlockProps.save(),b={width:_,height:_};return(0,o.createElement)("div",{...h},(0,o.createElement)("button",{className:"wp-block-ph-search-modal__button","data-micromodal-trigger":a,"aria-label":c},m?(0,o.createElement)("img",{src:m,alt:c,className:"wp-block-ph-search-modal__custom-icon",style:b}):(0,o.createElement)(n,{icon:i,style:b})),(0,o.createElement)("div",{className:"modal wp-block-ph-search-modal__fade",id:a,"aria-hidden":"true"},(0,o.createElement)("div",{className:"wp-block-ph-search-modal__overlay",tabIndex:"-1","data-micromodal-close":!0},(0,o.createElement)("div",{className:"wp-block-ph-search-modal__container",role:"dialog","aria-modal":"true","aria-labelledby":`${a}-title`},(0,o.createElement)("header",{className:"wp-block-ph-search-modal__header"},(0,o.createElement)("h2",{id:`${a}-title`,className:"screen-reader-text"},c),(0,o.createElement)("button",{className:"wp-block-ph-search-modal__close-button","aria-label":(0,r.__)("Close search modal","search-modal-block"),"data-micromodal-close":!0})),(0,o.createElement)("main",{className:"wp-block-ph-search-modal__content",id:`${a}-content`},(0,o.createElement)("form",{method:"GET",className:"wp-block-ph-search-modal__form wp-block-search",action:"/"},(0,o.createElement)("label",{className:s?"":"screen-reader-text",htmlFor:`${a}-input`},c),(0,o.createElement)("div",{className:"wp-block-ph-search-modal__form-controls"},(0,o.createElement)("input",{id:`${a}-input`,type:"text",name:"s",className:"wp-block-ph-search-modal__form-input wp-block-search__input",placeholder:l,required:!0}),(0,o.createElement)("div",{className:"wp-block-button"},(0,o.createElement)("button",{type:"submit",className:"wp-block-ph-search-modal__form-button wp-block-button__link",style:{cursor:"pointer"}},t)))))))))}})},20:(e,a,l)=>{var t=l(609),o=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};a.jsx=function(e,a,l){var t,s={},m=null,i=null;for(t in void 0!==l&&(m=""+l),void 0!==a.key&&(m=""+a.key),void 0!==a.ref&&(i=a.ref),a)r.call(a,t)&&!n.hasOwnProperty(t)&&(s[t]=a[t]);if(e&&e.defaultProps)for(t in a=e.defaultProps)void 0===s[t]&&(s[t]=a[t]);return{$$typeof:o,type:e,key:m,ref:i,props:s,_owner:c.current}}},848:(e,a,l)=>{e.exports=l(20)},609:e=>{e.exports=window.React}},l={};function t(e){var o=l[e];if(void 0!==o)return o.exports;var r=l[e]={exports:{}};return a[e](r,r.exports,t),r.exports}t.m=a,e=[],t.O=(a,l,o,r)=>{if(!l){var c=1/0;for(i=0;i<e.length;i++){l=e[i][0],o=e[i][1],r=e[i][2];for(var n=!0,s=0;s<l.length;s++)(!1&r||c>=r)&&Object.keys(t.O).every((e=>t.O[e](l[s])))?l.splice(s--,1):(n=!1,r<c&&(c=r));if(n){e.splice(i--,1);var m=o();void 0!==m&&(a=m)}}return a}r=r||0;for(var i=e.length;i>0&&e[i-1][2]>r;i--)e[i]=e[i-1];e[i]=[l,o,r]},t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={57:0,350:0};t.O.j=a=>0===e[a];var a=(a,l)=>{var o,r,c=l[0],n=l[1],s=l[2],m=0;if(c.some((a=>0!==e[a]))){for(o in n)t.o(n,o)&&(t.m[o]=n[o]);if(s)var i=s(t)}for(a&&a(l);m<c.length;m++)r=c[m],t.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return t.O(i)},l=self.webpackChunksearch_modal_block=self.webpackChunksearch_modal_block||[];l.forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l))})();var o=t.O(void 0,[350],(()=>t(633)));o=t.O(o)})(); -
search-modal-block/trunk/package.json
r3305896 r3394502 1 1 { 2 2 "name": "search-modal-block", 3 "version": "1. 1.0",3 "version": "1.2.0", 4 4 "description": "A customizable search modal block that adds an elegant and accessible search experience to your WordPress site.", 5 5 "author": "Phil Hoyt", -
search-modal-block/trunk/readme.txt
r3305896 r3394502 3 3 Tags: block, search, modal, search form, popup search 4 4 Requires at least: 6.1 5 Tested up to: 6. 8.16 Stable tag: 1. 1.05 Tested up to: 6.9 6 Stable tag: 1.2.0 7 7 Requires PHP: 7.4 8 8 License: GPL-2.0-or-later … … 77 77 == Changelog == 78 78 79 = 1.2.0 = 80 * WordPress 6.9 81 * Fixed form action URL to work correctly on subdirectory and multisite installations 82 * Improved accessibility with proper ARIA labels and modal title 83 79 84 = 1.1.0 = 80 85 * Added ability to upload custom icons for the search button -
search-modal-block/trunk/search-modal-block.php
r3305907 r3394502 5 5 * Description: Responsive search modal block. 6 6 * Requires at least: 6.1 7 * Requires PHP: 7. 38 * Version: 1. 1.07 * Requires PHP: 7.4 8 * Version: 1.2.0 9 9 * Author: Phil Hoyt 10 10 * Author URI: https://philhoyt.com … … 36 36 } 37 37 add_action( 'init', __NAMESPACE__ . '\\search_modal_block_init' ); 38 39 /** 40 * Filters the rendered block output to replace hardcoded form action URL 41 * with the correct WordPress home URL. 42 * 43 * This ensures the search form works correctly on: 44 * - WordPress installations in subdirectories 45 * - Multisite installations 46 * - Custom permalink structures 47 * 48 * @since 1.1.0 49 * 50 * @param string $block_content The block content about to be appended. 51 * @param array $block The full block, including name and attributes. 52 * @return string Modified block content. 53 */ 54 function search_modal_block_render( $block_content, $block ) { 55 // Only process our block. 56 if ( 'ph/search-modal' !== $block['blockName'] ) { 57 return $block_content; 58 } 59 60 // Replace hardcoded action="/" with the correct home URL. 61 $search_url = esc_url( home_url( '/' ) ); 62 $block_content = str_replace( 'action="/"', 'action="' . $search_url . '"', $block_content ); 63 64 return $block_content; 65 } 66 add_filter( 'render_block', __NAMESPACE__ . '\\search_modal_block_render', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.