diff --git a/.github/workflows/push-deploy.yml b/.github/workflows/push-deploy.yml index 87d2344..3d79158 100644 --- a/.github/workflows/push-deploy.yml +++ b/.github/workflows/push-deploy.yml @@ -1,10 +1,12 @@ name: Deploy to WordPress.org on: push: + branches: + - trunk tags-ignore: - - 'v*-alpha*' - - 'v*-beta*' - - 'v*-rc*' + - '-alpha*' + - '-beta*' + - '-rc*' jobs: tag: name: New tag diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 581bb87..eda31a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ # Add build zip to GitHub releases. -# Version: 1.0.0 +# Version: 1.1.0 name: Release @@ -49,6 +49,7 @@ jobs: id: composer-cache run: | echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: "Sets up Composer Caching." uses: "actions/cache@v2" with: @@ -56,13 +57,16 @@ jobs: key: ${{ runner.os }}-php-composer-build-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-php-composer-build- + - name: "Logs debug information." run: | php --version composer --version + - name: "Install Composer dependencies with development dependencies." run: | composer install --no-interaction --prefer-dist --no-scripts + - name: "Setup NodeJS." uses: actions/setup-node@v2 with: @@ -72,6 +76,7 @@ jobs: id: npm-cache-dir run: | echo "::set-output name=dir::$(npm config get cache)" + - name: "Sets up NPM Caching." uses: actions/cache@v2 with: @@ -79,23 +84,28 @@ jobs: key: ${{ runner.os }}-node-npm-build-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node-npm-build- + - name: "Install NPM dependencies." run: npm install - name: "Get release version." run: | echo "release_tag=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + echo "release_name=$(node -p -e "require('./package.json').name")" >> $GITHUB_ENV + - name: "Logs debug information." run: | node --version npm --version echo ${{ env.release_tag }} + - name: "Build release." run: | npm run release + - name: "Add package to GitHub releases." uses: softprops/action-gh-release@v1 with: - files: ./deploy/${{ env.release_tag }}/radio-buttons-for-taxonomies.zip + files: ./deploy/${{ env.release_name }}-${{ env.release_tag }}.zip env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Gruntfile.js b/Gruntfile.js index cb11201..d0ab205 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,6 +39,8 @@ module.exports = function(grunt) { all: ['js/*.js', '!js/*.min.js'] }, + // # Build and release + // Remove the build directory files clean: { main: ['build/**'] @@ -81,6 +83,22 @@ module.exports = function(grunt) { } }, + // Make a zipfile. + compress: { + main: { + options: { + mode: 'zip', + archive: 'deploy/<%= pkg.name %>-<%= pkg.version %>.zip' + }, + expand: true, + cwd: 'build/', + src: ['**/*'], + dest: '/<%= pkg.name %>' + } + }, + + // # Docs + // Generate git readme from readme.txt wp_readme_to_markdown: { convert: { @@ -147,6 +165,15 @@ module.exports = function(grunt) { }); + grunt.registerTask( + 'zip', + [ + 'clean', + 'copy', + 'compress' + ] + ); + // makepot and addtextdomain tasks grunt.loadNpmTasks('grunt-wp-i18n'); @@ -159,4 +186,6 @@ module.exports = function(grunt) { grunt.registerTask('build', ['replace', 'newer:uglify', 'makepot', 'wp_readme_to_markdown']); + grunt.registerTask( 'release', [ 'build', 'zip', 'clean' ] ); + }; diff --git a/inc/class-walker-category-radio.php b/inc/class-walker-category-radio.php index 93d5dde..e2e2a12 100644 --- a/inc/class-walker-category-radio.php +++ b/inc/class-walker-category-radio.php @@ -75,8 +75,14 @@ public function start_el( &$output, $category, $depth = 0, $args = array(), $id $this->printed_nonce = true; } - /* RB4T mod: Replace default $name variable */ - $name = 'radio_tax_input['.$taxonomy.']'; + /* RB4T mod: Replace default $name variable - Core naming conventions. */ + if ( 'category' === $taxonomy ) { + $name = 'post_category'; + } elseif ( 'post_tag' === $taxonomy ) { + $name = 'post_tag'; + } else { + $name = 'tax_input[' . $taxonomy . ']'; + } /* end */ $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; diff --git a/inc/class-wordpress-radio-taxonomy.php b/inc/class-wordpress-radio-taxonomy.php index 6dadbdf..3fa6af1 100644 --- a/inc/class-wordpress-radio-taxonomy.php +++ b/inc/class-wordpress-radio-taxonomy.php @@ -401,9 +401,10 @@ public function add_non_hierarchical_term() { $cat_id = $cat_id['term_id']; } - $data = sprintf( '
  • ', + $data = sprintf( '
  • ', esc_attr( $taxonomy->name ), intval( $cat_id ), + esc_attr( $taxonomy->name === 'post_tag' ? 'post_tag' : 'tax_input[ ' . $taxonomy->name . ']' ), esc_html( $cat_name ) ); @@ -451,19 +452,27 @@ function save_single_term( $post_id ) { return $post_id; } - // If posts are being bulk edited, and no term is selected, do nothing. - if ( ! empty( $_GET[ 'bulk_edit' ] ) && empty ( $_REQUEST[ 'radio_tax_input' ][ "{$this->taxonomy}" ] ) ) { - return $post_id; - } - // Verify nonce. if ( ! isset( $_REQUEST["_radio_nonce-{$this->taxonomy}"]) || ! wp_verify_nonce( $_REQUEST["_radio_nonce-{$this->taxonomy}"], "radio_nonce-{$this->taxonomy}" ) ) { return $post_id; } + if ( $this->taxonomy === 'category' ) { + $radio_tax_key = $_REQUEST['post_category' ]; + } elseif ( $this->taxonomy === 'post_tag' ) { + $radio_tax_key = $_REQUEST['post_tag' ]; + } else { + $radio_tax_key = $_REQUEST['tax_input']["{$this->taxonomy}"]; + } + + // If posts are being bulk edited, and no term is selected, do nothing. + if ( ! empty( $_GET[ 'bulk_edit' ] ) && empty ( $radio_tax_key ) ) { + return $post_id; + } + // OK, we must be authenticated by now: we need to make sure we're only saving 1 term. - if ( ! empty ( $_REQUEST["radio_tax_input"]["{$this->taxonomy}"] ) ) { - $terms = (array) $_REQUEST["radio_tax_input"]["{$this->taxonomy}"]; + if ( ! empty ( $radio_tax_key ) ) { + $terms = (array) $radio_tax_key; $single_term = intval( array_shift( $terms ) ); } else { // If not saving any terms, set to default. diff --git a/js/dist/index.asset.php b/js/dist/index.asset.php index 26e9fff..6ec1c8c 100644 --- a/js/dist/index.asset.php +++ b/js/dist/index.asset.php @@ -1 +1 @@ - array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '102c5bd05c574e9ce598'); + array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '459d2ed30f98546246ae'); diff --git a/js/dist/index.js b/js/dist/index.js index aa9c1da..827f80e 100644 --- a/js/dist/index.js +++ b/js/dist/index.js @@ -1,7 +1,5 @@ -(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,r=window.lodash,s=window.wp.i18n,a=window.wp.components,n=window.wp.data,o=window.wp.compose,i=window.wp.apiFetch;var l=e.n(i);const m=window.wp.url;function h(e){const t=e.map((e=>({children:[],parent:null,...e}))),s=(0,r.groupBy)(t,"parent");if(s.null&&s.null.length)return t;const a=e=>e.map((e=>{const t=s[e.id];return{...e,children:t&&t.length?a(t):[]}}));return a(s[0]||[])}const d={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent"};class c extends t.Component{constructor(){super(...arguments),this.findTerm=this.findTerm.bind(this),this.onChange=this.onChange.bind(this),this.onChangeFormName=this.onChangeFormName.bind(this),this.onChangeFormParent=this.onChangeFormParent.bind(this),this.onAddTerm=this.onAddTerm.bind(this),this.onToggleForm=this.onToggleForm.bind(this),this.setFilterValue=this.setFilterValue.bind(this),this.sortBySelected=this.sortBySelected.bind(this),this.state={loading:!0,availableTermsTree:[],availableTerms:[],adding:!1,formName:"",formParent:"",showForm:!1,filterValue:"",filteredTermsTree:[]}}onChange(e){const{onUpdateTerms:t,taxonomy:r}=this.props;t([e],r.rest_base)}onClear(){const{onUpdateTerms:e,taxonomy:t}=this.props;e([],t.rest_base)}onChangeFormName(e){const t=""===e.target.value.trim()?"":e.target.value;this.setState({formName:t})}onChangeFormParent(e){this.setState({formParent:e})}onToggleForm(){this.setState((e=>({showForm:!e.showForm})))}findTerm(e,t,s){return(0,r.find)(e,(e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===s.toLowerCase()))}onAddTerm(e){e.preventDefault();const{onUpdateTerms:t,taxonomy:a,terms:n,slug:o}=this.props,{formName:i,formParent:c,adding:p,availableTerms:u}=this.state;if(""===i||p)return;const g=this.findTerm(u,c,i);if(g)return(0,r.some)(n,(e=>e===g.id))||t([g.id],a.rest_base),void this.setState({formName:"",formParent:""});this.setState({adding:!0}),this.addRequest=l()({path:`/wp/v2/${a.rest_base}`,method:"POST",data:{name:i,parent:c||void 0}}),this.addRequest.catch((e=>"term_exists"===e.code?(this.addRequest=l()({path:(0,m.addQueryArgs)(`/wp/v2/${a.rest_base}`,{...d,parent:c||0,search:i})}),this.addRequest.then((e=>this.findTerm(e,c,i)))):Promise.reject(e))).then((e=>{const n=(0,r.find)(this.state.availableTerms,(t=>t.id===e.id))?this.state.availableTerms:[e,...this.state.availableTerms],i=(0,s.sprintf)( -/* translators: %s: taxonomy name */ -(0,s._x)("%s added","term"),(0,r.get)(this.props.taxonomy,["labels","singular_name"],"category"===o?(0,s.__)("Category"):(0,s.__)("Term")));this.props.speak(i,"assertive"),this.addRequest=null,this.setState({adding:!1,formName:"",formParent:"",availableTerms:n,availableTermsTree:this.sortBySelected(h(n))}),t([e.id],a.rest_base)}),(e=>{"abort"!==e.statusText&&(this.addRequest=null,this.setState({adding:!1}))}))}componentDidMount(){this.fetchTerms()}componentWillUnmount(){(0,r.invoke)(this.fetchRequest,["abort"]),(0,r.invoke)(this.addRequest,["abort"])}componentDidUpdate(e){this.props.taxonomy!==e.taxonomy&&this.fetchTerms()}fetchTerms(){const{taxonomy:e}=this.props;e&&(this.fetchRequest=l()({path:(0,m.addQueryArgs)(`/wp/v2/${e.rest_base}`,d)}),this.fetchRequest.then((e=>{const t=this.sortBySelected(h(e));this.fetchRequest=null,this.setState({loading:!1,availableTermsTree:t,availableTerms:e})}),(e=>{"abort"!==e.statusText&&(this.fetchRequest=null,this.setState({loading:!1}))})))}sortBySelected(e){const{terms:t}=this.props,r=e=>-1!==t.indexOf(e.id)||void 0!==e.children&&!!(e.children.map(r).filter((e=>e)).length>0);return e.sort(((e,t)=>{const s=r(e),a=r(t);return s===a?0:s&&!a?-1:!s&&a?1:0})),e}setFilterValue(e){const{availableTermsTree:t}=this.state,r=e.target.value,a=t.map(this.getFilterMatcher(r)).filter((e=>e)),n=e=>{let t=0;for(let r=0;r({children:[],parent:null,...e}))),s=(0,r.groupBy)(t,"parent");if(s.null&&s.null.length)return t;const a=e=>e.map((e=>{const t=s[e.id];return{...e,children:t&&t.length?a(t):[]}}));return a(s[0]||[])}const d={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent"};class c extends t.Component{constructor(){super(...arguments),this.findTerm=this.findTerm.bind(this),this.onChange=this.onChange.bind(this),this.onChangeFormName=this.onChangeFormName.bind(this),this.onChangeFormParent=this.onChangeFormParent.bind(this),this.onAddTerm=this.onAddTerm.bind(this),this.onToggleForm=this.onToggleForm.bind(this),this.setFilterValue=this.setFilterValue.bind(this),this.sortBySelected=this.sortBySelected.bind(this),this.state={loading:!0,availableTermsTree:[],availableTerms:[],adding:!1,formName:"",formParent:"",showForm:!1,filterValue:"",filteredTermsTree:[]}}onChange(e){const{onUpdateTerms:t,taxonomy:r}=this.props;t([e],r.rest_base)}onClear(){const{onUpdateTerms:e,taxonomy:t}=this.props;e([],t.rest_base)}onChangeFormName(e){const t=""===e.target.value.trim()?"":e.target.value;this.setState({formName:t})}onChangeFormParent(e){this.setState({formParent:e})}onToggleForm(){this.setState((e=>({showForm:!e.showForm})))}findTerm(e,t,s){return(0,r.find)(e,(e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===s.toLowerCase()))}onAddTerm(e){e.preventDefault();const{onUpdateTerms:t,taxonomy:a,terms:n,slug:o}=this.props,{formName:i,formParent:c,adding:p,availableTerms:u}=this.state;if(""===i||p)return;const g=this.findTerm(u,c,i);if(g)return(0,r.some)(n,(e=>e===g.id))||t([g.id],a.rest_base),void this.setState({formName:"",formParent:""});this.setState({adding:!0}),this.addRequest=l()({path:`/wp/v2/${a.rest_base}`,method:"POST",data:{name:i,parent:c||void 0}}),this.addRequest.catch((e=>"term_exists"===e.code?(this.addRequest=l()({path:(0,m.addQueryArgs)(`/wp/v2/${a.rest_base}`,{...d,parent:c||0,search:i})}),this.addRequest.then((e=>this.findTerm(e,c,i)))):Promise.reject(e))).then((e=>{const n=(0,r.find)(this.state.availableTerms,(t=>t.id===e.id))?this.state.availableTerms:[e,...this.state.availableTerms],i=(0,s.sprintf)(/* translators: %s: taxonomy name */ +(0,s._x)("%s added","term"),(0,r.get)(this.props.taxonomy,["labels","singular_name"],"category"===o?(0,s.__)("Category"):(0,s.__)("Term")));this.props.speak(i,"assertive"),this.addRequest=null,this.setState({adding:!1,formName:"",formParent:"",availableTerms:n,availableTermsTree:this.sortBySelected(h(n))}),t([e.id],a.rest_base)}),(e=>{"abort"!==e.statusText&&(this.addRequest=null,this.setState({adding:!1}))}))}componentDidMount(){this.fetchTerms()}componentWillUnmount(){(0,r.invoke)(this.fetchRequest,["abort"]),(0,r.invoke)(this.addRequest,["abort"])}componentDidUpdate(e){this.props.taxonomy!==e.taxonomy&&this.fetchTerms()}fetchTerms(){const{taxonomy:e}=this.props;e&&(this.fetchRequest=l()({path:(0,m.addQueryArgs)(`/wp/v2/${e.rest_base}`,d)}),this.fetchRequest.then((e=>{const t=this.sortBySelected(h(e));this.fetchRequest=null,this.setState({loading:!1,availableTermsTree:t,availableTerms:e})}),(e=>{"abort"!==e.statusText&&(this.fetchRequest=null,this.setState({loading:!1}))})))}sortBySelected(e){const{terms:t}=this.props,r=e=>-1!==t.indexOf(e.id)||void 0!==e.children&&!!(e.children.map(r).filter((e=>e)).length>0);return e.sort(((e,t)=>{const s=r(e),a=r(t);return s===a?0:s&&!a?-1:!s&&a?1:0})),e}setFilterValue(e){const{availableTermsTree:t}=this.state,r=e.target.value,a=t.map(this.getFilterMatcher(r)).filter((e=>e)),n=e=>{let t=0;for(let r=0;r{if(""===e)return r;const s={...r};return s.children.length>0&&(s.children=s.children.map(t).filter((e=>e))),(-1!==s.name.toLowerCase().indexOf(e.toLowerCase())||s.children.length>0)&&s};return t}renderTerms(e){const{terms:s=[],taxonomy:n}=this.props,o=n.hierarchical?"hierarchical":"non-hierarchical";return e.map((e=>{e.id;const i=-1!==s.indexOf(e.id)||!s.length&&e.id===n.default_term?e.id:0;return(0,t.createElement)("div",{key:e.id,className:"radio-taxonomies-choice editor-post-taxonomies__hierarchical-terms-choice "+(n.hierarchical?"":"editor-post-taxonomies__non-hierarchical-terms-choice")},(0,t.createElement)(a.RadioControl,{selected:i,options:[{label:(0,r.unescape)(e.name),value:e.id}],onChange:()=>{const t=parseInt(e.id,10);this.onChange(t)}}),!!e.children.length&&(0,t.createElement)("div",{className:"editor-post-taxonomies__"+o+"-terms-subchoices "},this.renderTerms(e.children)))}))}render(){const{slug:e,taxonomy:n,terms:o,instanceId:i,hasCreateAction:l,hasAssignAction:m}=this.props,h=n.hierarchical?"hierarchical":"non-hierarchical";if(!m)return null;const{availableTermsTree:d,availableTerms:c,filteredTermsTree:p,formName:u,formParent:g,loading:_,showForm:f,filterValue:b}=this.state,T=(t,s,a)=>(0,r.get)(n,["labels",t],"category"===e?s:a),w=T("add_new_item",(0,s.__)("Add new category"),(0,s.__)("Add new term")),y=T("new_item_name",(0,s.__)("Add new category"),(0,s.__)("Add new term")),x=T("parent_item",(0,s.__)("Parent Category"),(0,s.__)("Parent Term")),v=`— ${x} —`,C=w,F=`editor-post-taxonomies__${h}-terms-input-${i}`,S=`editor-post-taxonomies__${h}-terms-filter-${i}`,N=(0,r.get)(this.props.taxonomy,["labels","search_items"],(0,s.__)("Search Terms")),P=(0,r.get)(this.props.taxonomy,["name"],(0,s.__)("Terms")),k=c.length>=8,A=o.length?0:-1,E=(0,s.sprintf)( /* translators: %s: taxonomy name */ -(0,s._x)("No %s","term","radio-buttons-for-taxonomies"),(0,r.get)(this.props.taxonomy,["labels","singular_name"],"category"===e?(0,s.__)("Category"):(0,s.__)("Term")));return[k&&(0,t.createElement)("label",{key:"filter-label",htmlFor:S},N),k&&(0,t.createElement)("input",{type:"search",id:S,value:b,onChange:this.setFilterValue,className:"editor-post-taxonomies__hierarchical-terms-filter",key:"term-filter-input"}),(0,t.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",key:"term-list",tabIndex:"0",role:"group","aria-label":P},this.renderTerms(""!==b?p:d),n.radio_no_term&&(0,t.createElement)("div",{key:"no-term",className:"editor-post-taxonomies__"+h+"-terms-choice "},(0,t.createElement)(a.RadioControl,{selected:A,options:[{label:E,value:-1}],onChange:()=>{this.onClear()}}))),!_&&l&&(0,t.createElement)(a.Button,{key:"term-add-button",onClick:this.onToggleForm,className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":f,isLink:!0},w),f&&(0,t.createElement)("form",{onSubmit:this.onAddTerm,key:h+"-terms-form"},(0,t.createElement)("label",{htmlFor:F,className:"editor-post-taxonomies__hierarchical-terms-label"},y),(0,t.createElement)("input",{type:"text",id:F,className:"editor-post-taxonomies__hierarchical-terms-input",value:u,onChange:this.onChangeFormName,required:!0}),n.hierarchical&&!!c.length&&(0,t.createElement)(a.TreeSelect,{label:x,noOptionLabel:v,onChange:this.onChangeFormParent,selectedId:g,tree:d}),(0,t.createElement)(a.Button,{isSecondary:!0,type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit"},C))]}}const p=(0,o.compose)([(0,n.withSelect)(((e,t)=>{let{slug:s}=t;const{getCurrentPost:a}=e("core/editor"),{getTaxonomy:n}=e("core"),o=n(s);return{hasCreateAction:!!o&&(0,r.get)(a(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&(0,r.get)(a(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e("core/editor").getEditedPostAttribute(o.rest_base):[],taxonomy:o}})),(0,n.withDispatch)((e=>({onUpdateTerms(t,r){e("core/editor").editPost({[r]:t})}}))),a.withSpokenMessages,o.withInstanceId])(c);wp.hooks.addFilter("editor.PostTaxonomyType","RB4T",(function(e){return function(t){return RB4Tl18n.radio_taxonomies.indexOf(t.slug)>=0?wp.element.createElement(p,t):wp.element.createElement(e,t)}}))})(); \ No newline at end of file +(0,s._x)("No %s","term","radio-buttons-for-taxonomies"),(0,r.get)(this.props.taxonomy,["labels","singular_name"],"category"===e?(0,s.__)("Category"):(0,s.__)("Term")));return[k&&(0,t.createElement)("label",{key:"filter-label",htmlFor:S},N),k&&(0,t.createElement)("input",{type:"search",id:S,value:b,onChange:this.setFilterValue,className:"editor-post-taxonomies__hierarchical-terms-filter",key:"term-filter-input"}),(0,t.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",key:"term-list",tabIndex:"0",role:"group","aria-label":P},this.renderTerms(""!==b?p:d),n.radio_no_term&&(0,t.createElement)("div",{key:"no-term",className:"editor-post-taxonomies__"+h+"-terms-choice "},(0,t.createElement)(a.RadioControl,{selected:A,options:[{label:E,value:-1}],onChange:()=>{this.onClear()}}))),!_&&l&&(0,t.createElement)(a.Button,{key:"term-add-button",onClick:this.onToggleForm,className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":f,isLink:!0},w),f&&(0,t.createElement)("form",{onSubmit:this.onAddTerm,key:h+"-terms-form"},(0,t.createElement)("label",{htmlFor:F,className:"editor-post-taxonomies__hierarchical-terms-label"},y),(0,t.createElement)("input",{type:"text",id:F,className:"editor-post-taxonomies__hierarchical-terms-input",value:u,onChange:this.onChangeFormName,required:!0}),n.hierarchical&&!!c.length&&(0,t.createElement)(a.TreeSelect,{label:x,noOptionLabel:v,onChange:this.onChangeFormParent,selectedId:g,tree:d}),(0,t.createElement)(a.Button,{isSecondary:!0,type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit"},C))]}}var p=(0,o.compose)([(0,n.withSelect)(((e,t)=>{let{slug:s}=t;const{getCurrentPost:a}=e("core/editor"),{getTaxonomy:n}=e("core"),o=n(s);return{hasCreateAction:!!o&&(0,r.get)(a(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&(0,r.get)(a(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e("core/editor").getEditedPostAttribute(o.rest_base):[],taxonomy:o}})),(0,n.withDispatch)((e=>({onUpdateTerms(t,r){e("core/editor").editPost({[r]:t})}}))),a.withSpokenMessages,o.withInstanceId])(c);wp.hooks.addFilter("editor.PostTaxonomyType","RB4T",(function(e){return function(t){return RB4Tl18n.radio_taxonomies.indexOf(t.slug)>=0?wp.element.createElement(p,t):wp.element.createElement(e,t)}}))}(); \ No newline at end of file diff --git a/languages/radio-buttons-for-taxonomies.pot b/languages/radio-buttons-for-taxonomies.pot index a836e26..8ea9019 100644 --- a/languages/radio-buttons-for-taxonomies.pot +++ b/languages/radio-buttons-for-taxonomies.pot @@ -2,10 +2,10 @@ # This file is distributed under the same license as the Radio Buttons for Taxonomies package. msgid "" msgstr "" -"Project-Id-Version: Radio Buttons for Taxonomies 2.4.6\n" +"Project-Id-Version: Radio Buttons for Taxonomies 2.5.0-beta.1\n" "Report-Msgid-Bugs-To: " "https://wordpress.org/support/plugin/radio-buttons-for-taxonomies\n" -"POT-Creation-Date: 2023-02-16 00:19:13+00:00\n" +"POT-Creation-Date: 2023-02-20 23:42:16+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/package.json b/package.json index 783e88e..d0f4672 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "radio-buttons-for-taxonomies", "author": "helgatheviking", - "version": "2.4.6", + "version": "2.5.0-beta.1", "description": "Use radio buttons for any taxonomy so users can only select 1 term at a time", "repository": { "type": "git", @@ -14,14 +14,15 @@ "scripts": { "build": "wp-scripts build", "start": "wp-scripts start --webpack--devtool=source-map", - "release": "npm run build && grunt build" + "release": "npm run build && grunt release" }, "devDependencies": { - "@wordpress/scripts": "23.3.0", - "eslint": "^8.18.0", - "eslint-plugin-react": "^7.30.1", - "grunt": "^1.5.3", + "@wordpress/scripts": "25.4.0", + "eslint": "^8.34.0", + "eslint-plugin-react": "^7.32.2", + "grunt": "^1.6.1", "grunt-contrib-clean": "~2.0.1", + "grunt-contrib-compress": "^2.0.0", "grunt-contrib-concat": "^2.1.0", "grunt-contrib-copy": "~1.0.0", "grunt-contrib-jshint": "~3.2.0", diff --git a/radio-buttons-for-taxonomies.php b/radio-buttons-for-taxonomies.php index 077631a..1393243 100644 --- a/radio-buttons-for-taxonomies.php +++ b/radio-buttons-for-taxonomies.php @@ -3,7 +3,7 @@ * Plugin Name: Radio Buttons for Taxonomies * Plugin URI: http://www.kathyisawesome.com/441/radio-buttons-for-taxonomies * Description: Use radio buttons for any taxonomy so users can only select 1 term at a time - * Version: 2.4.6 + * Version: 2.5.0-beta.1 * Author: helgatheviking * Author URI: https://www.kathyisawesome.com * Requires at least: 4.5.0 @@ -46,7 +46,7 @@ class Radio_Buttons_For_Taxonomies { protected static $_instance = null; /* @var str $version */ - public static $version = '2.4.6'; + public static $version = '2.5.0-beta.1'; /* @var array $options - The plugin's options. */ public $options = array(); diff --git a/readme.md b/readme.md index 6066603..f48100a 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ **Tags:** taxonomy, admin, interface, ui, post, radio, terms, metabox **Requires at least:** 4.5.0 **Tested up to:** 6.1.0 -**Stable tag:** 2.4.6 +**Stable tag:** 2.5.0-beta.1 **License:** GPLv3 or later **License URI:** http://www.gnu.org/licenses/gpl-3.0.html @@ -53,6 +53,9 @@ So for example, to disabled the "No term" option on a taxonomy called "genre" yo ## Changelog ## +- 2023.02.20 - Version 2.5.0 = +* Fix: Rename inputs to match WP Core input names. Closes #71. + - 2022.02.15 - Version 2.4.6 = * Fix: Typo from 2.4.5 patch. Closes #111. diff --git a/readme.txt b/readme.txt index 8762b7c..9143861 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/fundraiser/charity/1451316 Tags: taxonomy, admin, interface, ui, post, radio, terms, metabox Requires at least: 4.5.0 Tested up to: 6.1.0 -Stable tag: 2.4.6 +Stable tag: 2.5.0-beta.1 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -53,6 +53,9 @@ add_filter( 'radio_buttons_for_taxonomies_no_term_genre', '__return_FALSE' ); == Changelog == +- 2023.02.20 - Version 2.5.0 = +* Fix: Rename inputs to match WP Core input names. Closes #71. + - 2022.02.15 - Version 2.4.6 = * Fix: Typo from 2.4.5 patch. Closes #111.