components
4 years ago
hoc
4 years ago
hooks
4 years ago
attributes.js
4 years ago
block.js
4 years ago
edit.js
4 years ago
editor.scss
4 years ago
query-parameters.js
4 years ago
templates.js
4 years ago
query-parameters.js
207 lines
| 1 | import { __ } from '@wordpress/i18n'; |
| 2 | |
| 3 | export default [ |
| 4 | { |
| 5 | id: 'post_type', |
| 6 | type: 'postTypeSelect', |
| 7 | default: 'post', |
| 8 | label: __( 'Post type', 'generateblocks' ), |
| 9 | description: __( 'Retrieves posts by post types.', 'generateblocks' ), |
| 10 | group: __( 'Post type', 'generateblocks' ), |
| 11 | isSticky: true, |
| 12 | }, |
| 13 | { |
| 14 | id: 'per_page', |
| 15 | type: 'number', |
| 16 | default: 10, |
| 17 | label: __( 'Posts per page', 'generateblocks' ), |
| 18 | description: __( 'Number of post to show per page.', 'generateblocks' ), |
| 19 | group: __( 'Pagination', 'generateblocks' ), |
| 20 | isSticky: true, |
| 21 | }, |
| 22 | { |
| 23 | id: 'page', |
| 24 | type: 'number', |
| 25 | default: 1, |
| 26 | label: __( 'Page', 'generateblocks' ), |
| 27 | description: __( 'Display posts from page.', 'generateblocks' ), |
| 28 | group: __( 'Pagination', 'generateblocks' ), |
| 29 | }, |
| 30 | { |
| 31 | id: 'offset', |
| 32 | type: 'number', |
| 33 | default: undefined, |
| 34 | label: __( 'Offset', 'generateblocks' ), |
| 35 | description: __( 'Offset the result set by a specific number of items.', 'generateblocks' ), |
| 36 | group: __( 'Pagination', 'generateblocks' ), |
| 37 | }, |
| 38 | { |
| 39 | id: 'search', |
| 40 | type: 'text', |
| 41 | default: '', |
| 42 | label: __( 'Search', 'generateblocks' ), |
| 43 | description: __( 'Show posts based on a keyword search.', 'generateblocks' ), |
| 44 | group: __( 'Search', 'generateblocks' ), |
| 45 | }, |
| 46 | { |
| 47 | id: 'order', |
| 48 | type: 'select', |
| 49 | default: 'desc', |
| 50 | selectOptions: [ |
| 51 | { value: 'desc', label: 'DESC' }, |
| 52 | { value: 'asc', label: 'ASC' }, |
| 53 | ], |
| 54 | label: __( 'Order', 'generateblocks' ), |
| 55 | description: __( 'Designates the ascending or descending order of the ‘orderby‘ parameter.', 'generateblocks' ), |
| 56 | group: __( 'Order & Order by', 'generateblocks' ), |
| 57 | }, |
| 58 | { |
| 59 | id: 'orderby', |
| 60 | type: 'select', |
| 61 | default: 'date', |
| 62 | selectOptions: [ |
| 63 | { value: 'id', label: 'Id' }, |
| 64 | { value: 'title', label: 'Title' }, |
| 65 | { value: 'slug', label: 'Slug' }, |
| 66 | { value: 'author', label: 'Author' }, |
| 67 | { value: 'date', label: 'Date' }, |
| 68 | { value: 'modified', label: 'Last modified date' }, |
| 69 | { value: 'parent', label: 'Parent id' }, |
| 70 | { value: 'menu_order', label: 'Menu order' }, |
| 71 | ], |
| 72 | label: __( 'Order by', 'generateblocks' ), |
| 73 | description: __( 'Sort retrieved posts by parameter.', 'generateblocks' ), |
| 74 | group: __( 'Order & Order by', 'generateblocks' ), |
| 75 | }, |
| 76 | { |
| 77 | id: 'author', |
| 78 | type: 'authorsSelect', |
| 79 | default: [], |
| 80 | label: __( 'Authors', 'generateblocks' ), |
| 81 | description: __( 'Show posts from authors.', 'generateblocks' ), |
| 82 | group: __( 'Author', 'generateblocks' ), |
| 83 | }, |
| 84 | { |
| 85 | id: 'author_exclude', |
| 86 | type: 'authorsSelect', |
| 87 | default: [], |
| 88 | label: __( 'Exclude authors', 'generateblocks' ), |
| 89 | description: __( 'Exclude posts from authors.', 'generateblocks' ), |
| 90 | group: __( 'Author', 'generateblocks' ), |
| 91 | }, |
| 92 | { |
| 93 | id: 'tax_query', |
| 94 | type: 'taxonomySelect', |
| 95 | default: [], |
| 96 | label: __( 'Taxonomies', 'generateblocks' ), |
| 97 | description: __( 'Show posts from taxonomies.', 'generateblocks' ), |
| 98 | group: __( 'Taxonomy', 'generateblocks' ), |
| 99 | isRepeatable: true, |
| 100 | repeatableDefaultValue: { taxonomy: '', terms: [], rest: '' }, |
| 101 | }, |
| 102 | { |
| 103 | id: 'tax_query_exclude', |
| 104 | type: 'taxonomySelect', |
| 105 | default: [], |
| 106 | label: __( 'Exclude taxonomies', 'generateblocks' ), |
| 107 | description: __( 'Exclude posts from taxonomies.', 'generateblocks' ), |
| 108 | group: __( 'Taxonomy', 'generateblocks' ), |
| 109 | isRepeatable: true, |
| 110 | repeatableDefaultValue: { taxonomy: '', terms: [], rest: '' }, |
| 111 | }, |
| 112 | { |
| 113 | id: 'status', |
| 114 | type: 'multiSelect', |
| 115 | default: [], |
| 116 | selectOptions: [ |
| 117 | { value: 'publish', label: __( 'Publish', 'generateblocks' ) }, |
| 118 | { value: 'pending', label: __( 'Pending', 'generateblocks' ) }, |
| 119 | { value: 'draft', label: __( 'Draft', 'generateblocks' ) }, |
| 120 | { value: 'auto-draft', label: __( 'Auto draft', 'generateblocks' ) }, |
| 121 | { value: 'future', label: __( 'Future', 'generateblocks' ) }, |
| 122 | { value: 'private', label: __( 'Private', 'generateblocks' ) }, |
| 123 | { value: 'inherit', label: __( 'Inherit', 'generateblocks' ) }, |
| 124 | { value: 'trash', label: __( 'Trash', 'generateblocks' ) }, |
| 125 | { value: 'any', label: __( 'Any', 'generateblocks' ) }, |
| 126 | ], |
| 127 | label: __( 'Post status', 'generateblocks' ), |
| 128 | description: __( 'Show posts by post status.', 'generateblocks' ), |
| 129 | group: __( 'Status', 'generateblocks' ), |
| 130 | }, |
| 131 | { |
| 132 | id: 'parent', |
| 133 | type: 'postsSelect', |
| 134 | default: [], |
| 135 | dependencies: { |
| 136 | postType: 'post_type', |
| 137 | }, |
| 138 | label: __( 'Parent', 'generateblocks' ), |
| 139 | description: __( 'Show posts from parents.', 'generateblocks' ), |
| 140 | group: __( 'Post', 'generateblocks' ), |
| 141 | }, |
| 142 | |
| 143 | { |
| 144 | id: 'parent_exclude', |
| 145 | type: 'postsSelect', |
| 146 | default: [], |
| 147 | dependencies: { |
| 148 | postType: 'post_type', |
| 149 | }, |
| 150 | label: __( 'Parent exclude', 'generateblocks' ), |
| 151 | description: __( 'Do not show posts from parents.', 'generateblocks' ), |
| 152 | group: __( 'Post', 'generateblocks' ), |
| 153 | }, |
| 154 | { |
| 155 | id: 'include', |
| 156 | type: 'postsSelect', |
| 157 | default: [], |
| 158 | dependencies: { |
| 159 | postType: 'post_type', |
| 160 | }, |
| 161 | label: __( 'Include posts', 'generateblocks' ), |
| 162 | description: __( 'Limit result set to specific posts.', 'generateblocks' ), |
| 163 | group: __( 'Post', 'generateblocks' ), |
| 164 | }, |
| 165 | { |
| 166 | id: 'exclude', |
| 167 | type: 'postsSelect', |
| 168 | default: [], |
| 169 | dependencies: { |
| 170 | postType: 'post_type', |
| 171 | }, |
| 172 | label: __( 'Exclude posts', 'generateblocks' ), |
| 173 | description: __( 'Ensure result set excludes specific posts.', 'generateblocks' ), |
| 174 | group: __( 'Post', 'generateblocks' ), |
| 175 | }, |
| 176 | { |
| 177 | id: 'stickyPosts', |
| 178 | type: 'select', |
| 179 | default: 'include', |
| 180 | selectOptions: [ |
| 181 | { value: 'include', label: 'Include' }, |
| 182 | { value: 'exclude', label: 'Exclude' }, |
| 183 | { value: 'ignore', label: 'Ignore' }, |
| 184 | { value: 'only', label: 'Only' }, |
| 185 | ], |
| 186 | label: __( 'Sticky posts', 'generateblocks' ), |
| 187 | description: __( 'Configure how sticky posts should show in the query.', 'generateblocks' ), |
| 188 | group: __( 'Post', 'generateblocks' ), |
| 189 | }, |
| 190 | { |
| 191 | id: 'after', |
| 192 | type: 'dateTimePicker', |
| 193 | default: '', |
| 194 | label: __( 'After', 'generateblocks' ), |
| 195 | description: __( 'Limit response to posts published after a given date.', 'generateblocks' ), |
| 196 | group: __( 'Date', 'generateblocks' ), |
| 197 | }, |
| 198 | { |
| 199 | id: 'before', |
| 200 | type: 'dateTimePicker', |
| 201 | default: '', |
| 202 | label: __( 'Before', 'generateblocks' ), |
| 203 | description: __( 'Limit response to posts published before a given date.', 'generateblocks' ), |
| 204 | group: __( 'Date', 'generateblocks' ), |
| 205 | }, |
| 206 | ]; |
| 207 |