| Conditions | 1 |
| Paths | 1 |
| Total Lines | 623 |
| Code Lines | 493 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 22 | public static function get_schema() { |
||
| 23 | $weight_unit = get_option( 'woocommerce_weight_unit' ); |
||
| 24 | $dimension_unit = get_option( 'woocommerce_dimension_unit' ); |
||
| 25 | $schema = array( |
||
| 26 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
||
| 27 | 'title' => 'product', |
||
| 28 | 'type' => 'object', |
||
| 29 | 'properties' => array( |
||
| 30 | 'id' => array( |
||
| 31 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), |
||
| 32 | 'type' => 'integer', |
||
| 33 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 34 | 'readonly' => true, |
||
| 35 | ), |
||
| 36 | 'name' => array( |
||
| 37 | 'description' => __( 'Product name.', 'woocommerce' ), |
||
| 38 | 'type' => 'string', |
||
| 39 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 40 | 'arg_options' => array( |
||
| 41 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 42 | ), |
||
| 43 | ), |
||
| 44 | 'slug' => array( |
||
| 45 | 'description' => __( 'Product slug.', 'woocommerce' ), |
||
| 46 | 'type' => 'string', |
||
| 47 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 48 | ), |
||
| 49 | 'permalink' => array( |
||
| 50 | 'description' => __( 'Product URL.', 'woocommerce' ), |
||
| 51 | 'type' => 'string', |
||
| 52 | 'format' => 'uri', |
||
| 53 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 54 | 'readonly' => true, |
||
| 55 | ), |
||
| 56 | 'date_created' => array( |
||
| 57 | 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce' ), |
||
| 58 | 'type' => 'date-time', |
||
| 59 | 'context' => array( 'view', 'edit' ), |
||
| 60 | ), |
||
| 61 | 'date_created_gmt' => array( |
||
| 62 | 'description' => __( 'The date the product was created, as GMT.', 'woocommerce' ), |
||
| 63 | 'type' => 'date-time', |
||
| 64 | 'context' => array( 'view', 'edit' ), |
||
| 65 | ), |
||
| 66 | 'date_modified' => array( |
||
| 67 | 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce' ), |
||
| 68 | 'type' => 'date-time', |
||
| 69 | 'context' => array( 'view', 'edit' ), |
||
| 70 | 'readonly' => true, |
||
| 71 | ), |
||
| 72 | 'date_modified_gmt' => array( |
||
| 73 | 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce' ), |
||
| 74 | 'type' => 'date-time', |
||
| 75 | 'context' => array( 'view', 'edit' ), |
||
| 76 | 'readonly' => true, |
||
| 77 | ), |
||
| 78 | 'type' => array( |
||
| 79 | 'description' => __( 'Product type.', 'woocommerce' ), |
||
| 80 | 'type' => 'string', |
||
| 81 | 'default' => 'simple', |
||
| 82 | 'enum' => array_keys( wc_get_product_types() ), |
||
| 83 | 'context' => array( 'view', 'edit' ), |
||
| 84 | ), |
||
| 85 | 'status' => array( |
||
| 86 | 'description' => __( 'Product status (post status).', 'woocommerce' ), |
||
| 87 | 'type' => 'string', |
||
| 88 | 'default' => 'publish', |
||
| 89 | 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), |
||
| 90 | 'context' => array( 'view', 'edit' ), |
||
| 91 | ), |
||
| 92 | 'featured' => array( |
||
| 93 | 'description' => __( 'Featured product.', 'woocommerce' ), |
||
| 94 | 'type' => 'boolean', |
||
| 95 | 'default' => false, |
||
| 96 | 'context' => array( 'view', 'edit' ), |
||
| 97 | ), |
||
| 98 | 'catalog_visibility' => array( |
||
| 99 | 'description' => __( 'Catalog visibility.', 'woocommerce' ), |
||
| 100 | 'type' => 'string', |
||
| 101 | 'default' => 'visible', |
||
| 102 | 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), |
||
| 103 | 'context' => array( 'view', 'edit' ), |
||
| 104 | ), |
||
| 105 | 'description' => array( |
||
| 106 | 'description' => __( 'Product description.', 'woocommerce' ), |
||
| 107 | 'type' => 'string', |
||
| 108 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 109 | 'arg_options' => array( |
||
| 110 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 111 | ), |
||
| 112 | ), |
||
| 113 | 'short_description' => array( |
||
| 114 | 'description' => __( 'Product short description.', 'woocommerce' ), |
||
| 115 | 'type' => 'string', |
||
| 116 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 117 | 'arg_options' => array( |
||
| 118 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 119 | ), |
||
| 120 | ), |
||
| 121 | 'sku' => array( |
||
| 122 | 'description' => __( 'Unique identifier.', 'woocommerce' ), |
||
| 123 | 'type' => 'string', |
||
| 124 | 'context' => array( 'view', 'edit' ), |
||
| 125 | 'arg_options' => array( |
||
| 126 | 'sanitize_callback' => 'wc_clean', |
||
| 127 | ), |
||
| 128 | ), |
||
| 129 | 'price' => array( |
||
| 130 | 'description' => __( 'Current product price.', 'woocommerce' ), |
||
| 131 | 'type' => 'string', |
||
| 132 | 'context' => array( 'view', 'edit' ), |
||
| 133 | 'readonly' => true, |
||
| 134 | ), |
||
| 135 | 'regular_price' => array( |
||
| 136 | 'description' => __( 'Product regular price.', 'woocommerce' ), |
||
| 137 | 'type' => 'string', |
||
| 138 | 'context' => array( 'view', 'edit' ), |
||
| 139 | ), |
||
| 140 | 'sale_price' => array( |
||
| 141 | 'description' => __( 'Product sale price.', 'woocommerce' ), |
||
| 142 | 'type' => 'string', |
||
| 143 | 'context' => array( 'view', 'edit' ), |
||
| 144 | ), |
||
| 145 | 'date_on_sale_from' => array( |
||
| 146 | 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), |
||
| 147 | 'type' => 'date-time', |
||
| 148 | 'context' => array( 'view', 'edit' ), |
||
| 149 | ), |
||
| 150 | 'date_on_sale_from_gmt' => array( |
||
| 151 | 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), |
||
| 152 | 'type' => 'date-time', |
||
| 153 | 'context' => array( 'view', 'edit' ), |
||
| 154 | ), |
||
| 155 | 'date_on_sale_to' => array( |
||
| 156 | 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), |
||
| 157 | 'type' => 'date-time', |
||
| 158 | 'context' => array( 'view', 'edit' ), |
||
| 159 | ), |
||
| 160 | 'date_on_sale_to_gmt' => array( |
||
| 161 | 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), |
||
| 162 | 'type' => 'date-time', |
||
| 163 | 'context' => array( 'view', 'edit' ), |
||
| 164 | ), |
||
| 165 | 'price_html' => array( |
||
| 166 | 'description' => __( 'Price formatted in HTML.', 'woocommerce' ), |
||
| 167 | 'type' => 'string', |
||
| 168 | 'context' => array( 'view', 'edit' ), |
||
| 169 | 'readonly' => true, |
||
| 170 | ), |
||
| 171 | 'on_sale' => array( |
||
| 172 | 'description' => __( 'Shows if the product is on sale.', 'woocommerce' ), |
||
| 173 | 'type' => 'boolean', |
||
| 174 | 'context' => array( 'view', 'edit' ), |
||
| 175 | 'readonly' => true, |
||
| 176 | ), |
||
| 177 | 'purchasable' => array( |
||
| 178 | 'description' => __( 'Shows if the product can be bought.', 'woocommerce' ), |
||
| 179 | 'type' => 'boolean', |
||
| 180 | 'context' => array( 'view', 'edit' ), |
||
| 181 | 'readonly' => true, |
||
| 182 | ), |
||
| 183 | 'total_sales' => array( |
||
| 184 | 'description' => __( 'Amount of sales.', 'woocommerce' ), |
||
| 185 | 'type' => 'integer', |
||
| 186 | 'context' => array( 'view', 'edit' ), |
||
| 187 | 'readonly' => true, |
||
| 188 | ), |
||
| 189 | 'virtual' => array( |
||
| 190 | 'description' => __( 'If the product is virtual.', 'woocommerce' ), |
||
| 191 | 'type' => 'boolean', |
||
| 192 | 'default' => false, |
||
| 193 | 'context' => array( 'view', 'edit' ), |
||
| 194 | ), |
||
| 195 | 'downloadable' => array( |
||
| 196 | 'description' => __( 'If the product is downloadable.', 'woocommerce' ), |
||
| 197 | 'type' => 'boolean', |
||
| 198 | 'default' => false, |
||
| 199 | 'context' => array( 'view', 'edit' ), |
||
| 200 | ), |
||
| 201 | 'downloads' => array( |
||
| 202 | 'description' => __( 'List of downloadable files.', 'woocommerce' ), |
||
| 203 | 'type' => 'array', |
||
| 204 | 'context' => array( 'view', 'edit' ), |
||
| 205 | 'items' => array( |
||
| 206 | 'type' => 'object', |
||
| 207 | 'properties' => array( |
||
| 208 | 'id' => array( |
||
| 209 | 'description' => __( 'File ID.', 'woocommerce' ), |
||
| 210 | 'type' => 'string', |
||
| 211 | 'context' => array( 'view', 'edit' ), |
||
| 212 | ), |
||
| 213 | 'name' => array( |
||
| 214 | 'description' => __( 'File name.', 'woocommerce' ), |
||
| 215 | 'type' => 'string', |
||
| 216 | 'context' => array( 'view', 'edit' ), |
||
| 217 | ), |
||
| 218 | 'file' => array( |
||
| 219 | 'description' => __( 'File URL.', 'woocommerce' ), |
||
| 220 | 'type' => 'string', |
||
| 221 | 'context' => array( 'view', 'edit' ), |
||
| 222 | ), |
||
| 223 | ), |
||
| 224 | ), |
||
| 225 | ), |
||
| 226 | 'download_limit' => array( |
||
| 227 | 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), |
||
| 228 | 'type' => 'integer', |
||
| 229 | 'default' => -1, |
||
| 230 | 'context' => array( 'view', 'edit' ), |
||
| 231 | ), |
||
| 232 | 'download_expiry' => array( |
||
| 233 | 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), |
||
| 234 | 'type' => 'integer', |
||
| 235 | 'default' => -1, |
||
| 236 | 'context' => array( 'view', 'edit' ), |
||
| 237 | ), |
||
| 238 | 'external_url' => array( |
||
| 239 | 'description' => __( 'Product external URL. Only for external products.', 'woocommerce' ), |
||
| 240 | 'type' => 'string', |
||
| 241 | 'format' => 'uri', |
||
| 242 | 'context' => array( 'view', 'edit' ), |
||
| 243 | ), |
||
| 244 | 'button_text' => array( |
||
| 245 | 'description' => __( 'Product external button text. Only for external products.', 'woocommerce' ), |
||
| 246 | 'type' => 'string', |
||
| 247 | 'context' => array( 'view', 'edit' ), |
||
| 248 | ), |
||
| 249 | 'tax_status' => array( |
||
| 250 | 'description' => __( 'Tax status.', 'woocommerce' ), |
||
| 251 | 'type' => 'string', |
||
| 252 | 'default' => 'taxable', |
||
| 253 | 'enum' => array( 'taxable', 'shipping', 'none' ), |
||
| 254 | 'context' => array( 'view', 'edit' ), |
||
| 255 | ), |
||
| 256 | 'tax_class' => array( |
||
| 257 | 'description' => __( 'Tax class.', 'woocommerce' ), |
||
| 258 | 'type' => 'string', |
||
| 259 | 'context' => array( 'view', 'edit' ), |
||
| 260 | ), |
||
| 261 | 'manage_stock' => array( |
||
| 262 | 'description' => __( 'Stock management at product level.', 'woocommerce' ), |
||
| 263 | 'type' => 'boolean', |
||
| 264 | 'default' => false, |
||
| 265 | 'context' => array( 'view', 'edit' ), |
||
| 266 | ), |
||
| 267 | 'stock_quantity' => array( |
||
| 268 | 'description' => __( 'Stock quantity.', 'woocommerce' ), |
||
| 269 | 'type' => 'integer', |
||
| 270 | 'context' => array( 'view', 'edit' ), |
||
| 271 | ), |
||
| 272 | 'stock_status' => array( |
||
| 273 | 'description' => __( 'Controls the stock status of the product.', 'woocommerce' ), |
||
| 274 | 'type' => 'string', |
||
| 275 | 'default' => 'instock', |
||
| 276 | 'enum' => array_keys( wc_get_product_stock_status_options() ), |
||
| 277 | 'context' => array( 'view', 'edit' ), |
||
| 278 | ), |
||
| 279 | 'backorders' => array( |
||
| 280 | 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), |
||
| 281 | 'type' => 'string', |
||
| 282 | 'default' => 'no', |
||
| 283 | 'enum' => array( 'no', 'notify', 'yes' ), |
||
| 284 | 'context' => array( 'view', 'edit' ), |
||
| 285 | ), |
||
| 286 | 'backorders_allowed' => array( |
||
| 287 | 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), |
||
| 288 | 'type' => 'boolean', |
||
| 289 | 'context' => array( 'view', 'edit' ), |
||
| 290 | 'readonly' => true, |
||
| 291 | ), |
||
| 292 | 'backordered' => array( |
||
| 293 | 'description' => __( 'Shows if the product is on backordered.', 'woocommerce' ), |
||
| 294 | 'type' => 'boolean', |
||
| 295 | 'context' => array( 'view', 'edit' ), |
||
| 296 | 'readonly' => true, |
||
| 297 | ), |
||
| 298 | 'sold_individually' => array( |
||
| 299 | 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce' ), |
||
| 300 | 'type' => 'boolean', |
||
| 301 | 'default' => false, |
||
| 302 | 'context' => array( 'view', 'edit' ), |
||
| 303 | ), |
||
| 304 | 'weight' => array( |
||
| 305 | /* translators: %s: weight unit */ |
||
| 306 | 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce' ), $weight_unit ), |
||
|
|
|||
| 307 | 'type' => 'string', |
||
| 308 | 'context' => array( 'view', 'edit' ), |
||
| 309 | ), |
||
| 310 | 'dimensions' => array( |
||
| 311 | 'description' => __( 'Product dimensions.', 'woocommerce' ), |
||
| 312 | 'type' => 'object', |
||
| 313 | 'context' => array( 'view', 'edit' ), |
||
| 314 | 'properties' => array( |
||
| 315 | 'length' => array( |
||
| 316 | /* translators: %s: dimension unit */ |
||
| 317 | 'description' => sprintf( __( 'Product length (%s).', 'woocommerce' ), $dimension_unit ), |
||
| 318 | 'type' => 'string', |
||
| 319 | 'context' => array( 'view', 'edit' ), |
||
| 320 | ), |
||
| 321 | 'width' => array( |
||
| 322 | /* translators: %s: dimension unit */ |
||
| 323 | 'description' => sprintf( __( 'Product width (%s).', 'woocommerce' ), $dimension_unit ), |
||
| 324 | 'type' => 'string', |
||
| 325 | 'context' => array( 'view', 'edit' ), |
||
| 326 | ), |
||
| 327 | 'height' => array( |
||
| 328 | /* translators: %s: dimension unit */ |
||
| 329 | 'description' => sprintf( __( 'Product height (%s).', 'woocommerce' ), $dimension_unit ), |
||
| 330 | 'type' => 'string', |
||
| 331 | 'context' => array( 'view', 'edit' ), |
||
| 332 | ), |
||
| 333 | ), |
||
| 334 | ), |
||
| 335 | 'shipping_required' => array( |
||
| 336 | 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce' ), |
||
| 337 | 'type' => 'boolean', |
||
| 338 | 'context' => array( 'view', 'edit' ), |
||
| 339 | 'readonly' => true, |
||
| 340 | ), |
||
| 341 | 'shipping_taxable' => array( |
||
| 342 | 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce' ), |
||
| 343 | 'type' => 'boolean', |
||
| 344 | 'context' => array( 'view', 'edit' ), |
||
| 345 | 'readonly' => true, |
||
| 346 | ), |
||
| 347 | 'shipping_class' => array( |
||
| 348 | 'description' => __( 'Shipping class slug.', 'woocommerce' ), |
||
| 349 | 'type' => 'string', |
||
| 350 | 'context' => array( 'view', 'edit' ), |
||
| 351 | ), |
||
| 352 | 'shipping_class_id' => array( |
||
| 353 | 'description' => __( 'Shipping class ID.', 'woocommerce' ), |
||
| 354 | 'type' => 'string', |
||
| 355 | 'context' => array( 'view', 'edit' ), |
||
| 356 | 'readonly' => true, |
||
| 357 | ), |
||
| 358 | 'reviews_allowed' => array( |
||
| 359 | 'description' => __( 'Allow reviews.', 'woocommerce' ), |
||
| 360 | 'type' => 'boolean', |
||
| 361 | 'default' => true, |
||
| 362 | 'context' => array( 'view', 'edit' ), |
||
| 363 | ), |
||
| 364 | 'average_rating' => array( |
||
| 365 | 'description' => __( 'Reviews average rating.', 'woocommerce' ), |
||
| 366 | 'type' => 'string', |
||
| 367 | 'context' => array( 'view', 'edit' ), |
||
| 368 | 'readonly' => true, |
||
| 369 | ), |
||
| 370 | 'rating_count' => array( |
||
| 371 | 'description' => __( 'Amount of reviews that the product have.', 'woocommerce' ), |
||
| 372 | 'type' => 'integer', |
||
| 373 | 'context' => array( 'view', 'edit' ), |
||
| 374 | 'readonly' => true, |
||
| 375 | ), |
||
| 376 | 'related_ids' => array( |
||
| 377 | 'description' => __( 'List of related products IDs.', 'woocommerce' ), |
||
| 378 | 'type' => 'array', |
||
| 379 | 'items' => array( |
||
| 380 | 'type' => 'integer', |
||
| 381 | ), |
||
| 382 | 'context' => array( 'view', 'edit' ), |
||
| 383 | 'readonly' => true, |
||
| 384 | ), |
||
| 385 | 'upsell_ids' => array( |
||
| 386 | 'description' => __( 'List of up-sell products IDs.', 'woocommerce' ), |
||
| 387 | 'type' => 'array', |
||
| 388 | 'items' => array( |
||
| 389 | 'type' => 'integer', |
||
| 390 | ), |
||
| 391 | 'context' => array( 'view', 'edit' ), |
||
| 392 | ), |
||
| 393 | 'cross_sell_ids' => array( |
||
| 394 | 'description' => __( 'List of cross-sell products IDs.', 'woocommerce' ), |
||
| 395 | 'type' => 'array', |
||
| 396 | 'items' => array( |
||
| 397 | 'type' => 'integer', |
||
| 398 | ), |
||
| 399 | 'context' => array( 'view', 'edit' ), |
||
| 400 | ), |
||
| 401 | 'parent_id' => array( |
||
| 402 | 'description' => __( 'Product parent ID.', 'woocommerce' ), |
||
| 403 | 'type' => 'integer', |
||
| 404 | 'context' => array( 'view', 'edit' ), |
||
| 405 | ), |
||
| 406 | 'purchase_note' => array( |
||
| 407 | 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce' ), |
||
| 408 | 'type' => 'string', |
||
| 409 | 'context' => array( 'view', 'edit' ), |
||
| 410 | 'arg_options' => array( |
||
| 411 | 'sanitize_callback' => 'wp_kses_post', |
||
| 412 | ), |
||
| 413 | ), |
||
| 414 | 'categories' => array( |
||
| 415 | 'description' => __( 'List of categories.', 'woocommerce' ), |
||
| 416 | 'type' => 'array', |
||
| 417 | 'context' => array( 'view', 'edit' ), |
||
| 418 | 'items' => array( |
||
| 419 | 'type' => 'object', |
||
| 420 | 'properties' => array( |
||
| 421 | 'id' => array( |
||
| 422 | 'description' => __( 'Category ID.', 'woocommerce' ), |
||
| 423 | 'type' => 'integer', |
||
| 424 | 'context' => array( 'view', 'edit' ), |
||
| 425 | ), |
||
| 426 | 'name' => array( |
||
| 427 | 'description' => __( 'Category name.', 'woocommerce' ), |
||
| 428 | 'type' => 'string', |
||
| 429 | 'context' => array( 'view', 'edit' ), |
||
| 430 | 'readonly' => true, |
||
| 431 | ), |
||
| 432 | 'slug' => array( |
||
| 433 | 'description' => __( 'Category slug.', 'woocommerce' ), |
||
| 434 | 'type' => 'string', |
||
| 435 | 'context' => array( 'view', 'edit' ), |
||
| 436 | 'readonly' => true, |
||
| 437 | ), |
||
| 438 | ), |
||
| 439 | ), |
||
| 440 | ), |
||
| 441 | 'tags' => array( |
||
| 442 | 'description' => __( 'List of tags.', 'woocommerce' ), |
||
| 443 | 'type' => 'array', |
||
| 444 | 'context' => array( 'view', 'edit' ), |
||
| 445 | 'items' => array( |
||
| 446 | 'type' => 'object', |
||
| 447 | 'properties' => array( |
||
| 448 | 'id' => array( |
||
| 449 | 'description' => __( 'Tag ID.', 'woocommerce' ), |
||
| 450 | 'type' => 'integer', |
||
| 451 | 'context' => array( 'view', 'edit' ), |
||
| 452 | ), |
||
| 453 | 'name' => array( |
||
| 454 | 'description' => __( 'Tag name.', 'woocommerce' ), |
||
| 455 | 'type' => 'string', |
||
| 456 | 'context' => array( 'view', 'edit' ), |
||
| 457 | 'readonly' => true, |
||
| 458 | ), |
||
| 459 | 'slug' => array( |
||
| 460 | 'description' => __( 'Tag slug.', 'woocommerce' ), |
||
| 461 | 'type' => 'string', |
||
| 462 | 'context' => array( 'view', 'edit' ), |
||
| 463 | 'readonly' => true, |
||
| 464 | ), |
||
| 465 | ), |
||
| 466 | ), |
||
| 467 | ), |
||
| 468 | 'images' => array( |
||
| 469 | 'description' => __( 'List of images.', 'woocommerce' ), |
||
| 470 | 'type' => 'object', |
||
| 471 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 472 | 'items' => array( |
||
| 473 | 'type' => 'object', |
||
| 474 | 'properties' => array( |
||
| 475 | 'id' => array( |
||
| 476 | 'description' => __( 'Image ID.', 'woocommerce' ), |
||
| 477 | 'type' => 'integer', |
||
| 478 | 'context' => array( 'view', 'edit' ), |
||
| 479 | ), |
||
| 480 | 'date_created' => array( |
||
| 481 | 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), |
||
| 482 | 'type' => 'date-time', |
||
| 483 | 'context' => array( 'view', 'edit' ), |
||
| 484 | 'readonly' => true, |
||
| 485 | ), |
||
| 486 | 'date_created_gmt' => array( |
||
| 487 | 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), |
||
| 488 | 'type' => 'date-time', |
||
| 489 | 'context' => array( 'view', 'edit' ), |
||
| 490 | 'readonly' => true, |
||
| 491 | ), |
||
| 492 | 'date_modified' => array( |
||
| 493 | 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), |
||
| 494 | 'type' => 'date-time', |
||
| 495 | 'context' => array( 'view', 'edit' ), |
||
| 496 | 'readonly' => true, |
||
| 497 | ), |
||
| 498 | 'date_modified_gmt' => array( |
||
| 499 | 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), |
||
| 500 | 'type' => 'date-time', |
||
| 501 | 'context' => array( 'view', 'edit' ), |
||
| 502 | 'readonly' => true, |
||
| 503 | ), |
||
| 504 | 'src' => array( |
||
| 505 | 'description' => __( 'Image URL.', 'woocommerce' ), |
||
| 506 | 'type' => 'string', |
||
| 507 | 'format' => 'uri', |
||
| 508 | 'context' => array( 'view', 'edit' ), |
||
| 509 | ), |
||
| 510 | 'name' => array( |
||
| 511 | 'description' => __( 'Image name.', 'woocommerce' ), |
||
| 512 | 'type' => 'string', |
||
| 513 | 'context' => array( 'view', 'edit' ), |
||
| 514 | ), |
||
| 515 | 'alt' => array( |
||
| 516 | 'description' => __( 'Image alternative text.', 'woocommerce' ), |
||
| 517 | 'type' => 'string', |
||
| 518 | 'context' => array( 'view', 'edit' ), |
||
| 519 | ), |
||
| 520 | ), |
||
| 521 | ), |
||
| 522 | ), |
||
| 523 | 'attributes' => array( |
||
| 524 | 'description' => __( 'List of attributes.', 'woocommerce' ), |
||
| 525 | 'type' => 'array', |
||
| 526 | 'context' => array( 'view', 'edit' ), |
||
| 527 | 'items' => array( |
||
| 528 | 'type' => 'object', |
||
| 529 | 'properties' => array( |
||
| 530 | 'id' => array( |
||
| 531 | 'description' => __( 'Attribute ID.', 'woocommerce' ), |
||
| 532 | 'type' => 'integer', |
||
| 533 | 'context' => array( 'view', 'edit' ), |
||
| 534 | ), |
||
| 535 | 'name' => array( |
||
| 536 | 'description' => __( 'Attribute name.', 'woocommerce' ), |
||
| 537 | 'type' => 'string', |
||
| 538 | 'context' => array( 'view', 'edit' ), |
||
| 539 | ), |
||
| 540 | 'position' => array( |
||
| 541 | 'description' => __( 'Attribute position.', 'woocommerce' ), |
||
| 542 | 'type' => 'integer', |
||
| 543 | 'context' => array( 'view', 'edit' ), |
||
| 544 | ), |
||
| 545 | 'visible' => array( |
||
| 546 | 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce' ), |
||
| 547 | 'type' => 'boolean', |
||
| 548 | 'default' => false, |
||
| 549 | 'context' => array( 'view', 'edit' ), |
||
| 550 | ), |
||
| 551 | 'variation' => array( |
||
| 552 | 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce' ), |
||
| 553 | 'type' => 'boolean', |
||
| 554 | 'default' => false, |
||
| 555 | 'context' => array( 'view', 'edit' ), |
||
| 556 | ), |
||
| 557 | 'options' => array( |
||
| 558 | 'description' => __( 'List of available term names of the attribute.', 'woocommerce' ), |
||
| 559 | 'type' => 'array', |
||
| 560 | 'items' => array( |
||
| 561 | 'type' => 'string', |
||
| 562 | ), |
||
| 563 | 'context' => array( 'view', 'edit' ), |
||
| 564 | ), |
||
| 565 | ), |
||
| 566 | ), |
||
| 567 | ), |
||
| 568 | 'default_attributes' => array( |
||
| 569 | 'description' => __( 'Defaults variation attributes.', 'woocommerce' ), |
||
| 570 | 'type' => 'array', |
||
| 571 | 'context' => array( 'view', 'edit' ), |
||
| 572 | 'items' => array( |
||
| 573 | 'type' => 'object', |
||
| 574 | 'properties' => array( |
||
| 575 | 'id' => array( |
||
| 576 | 'description' => __( 'Attribute ID.', 'woocommerce' ), |
||
| 577 | 'type' => 'integer', |
||
| 578 | 'context' => array( 'view', 'edit' ), |
||
| 579 | ), |
||
| 580 | 'name' => array( |
||
| 581 | 'description' => __( 'Attribute name.', 'woocommerce' ), |
||
| 582 | 'type' => 'string', |
||
| 583 | 'context' => array( 'view', 'edit' ), |
||
| 584 | ), |
||
| 585 | 'option' => array( |
||
| 586 | 'description' => __( 'Selected attribute term name.', 'woocommerce' ), |
||
| 587 | 'type' => 'string', |
||
| 588 | 'context' => array( 'view', 'edit' ), |
||
| 589 | ), |
||
| 590 | ), |
||
| 591 | ), |
||
| 592 | ), |
||
| 593 | 'variations' => array( |
||
| 594 | 'description' => __( 'List of variations IDs.', 'woocommerce' ), |
||
| 595 | 'type' => 'array', |
||
| 596 | 'context' => array( 'view', 'edit' ), |
||
| 597 | 'items' => array( |
||
| 598 | 'type' => 'integer', |
||
| 599 | ), |
||
| 600 | 'readonly' => true, |
||
| 601 | ), |
||
| 602 | 'grouped_products' => array( |
||
| 603 | 'description' => __( 'List of grouped products ID.', 'woocommerce' ), |
||
| 604 | 'type' => 'array', |
||
| 605 | 'items' => array( |
||
| 606 | 'type' => 'integer', |
||
| 607 | ), |
||
| 608 | 'context' => array( 'view', 'edit' ), |
||
| 609 | 'readonly' => true, |
||
| 610 | ), |
||
| 611 | 'menu_order' => array( |
||
| 612 | 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), |
||
| 613 | 'type' => 'integer', |
||
| 614 | 'context' => array( 'view', 'edit' ), |
||
| 615 | ), |
||
| 616 | 'meta_data' => array( |
||
| 617 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
| 618 | 'type' => 'array', |
||
| 619 | 'context' => array( 'view', 'edit' ), |
||
| 620 | 'items' => array( |
||
| 621 | 'type' => 'object', |
||
| 622 | 'properties' => array( |
||
| 623 | 'id' => array( |
||
| 624 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
| 625 | 'type' => 'integer', |
||
| 626 | 'context' => array( 'view', 'edit' ), |
||
| 627 | 'readonly' => true, |
||
| 628 | ), |
||
| 629 | 'key' => array( |
||
| 630 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
| 631 | 'type' => 'string', |
||
| 632 | 'context' => array( 'view', 'edit' ), |
||
| 633 | ), |
||
| 634 | 'value' => array( |
||
| 635 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
| 636 | 'type' => 'mixed', |
||
| 637 | 'context' => array( 'view', 'edit' ), |
||
| 638 | ), |
||
| 639 | ), |
||
| 640 | ), |
||
| 641 | ), |
||
| 642 | ), |
||
| 643 | ); |
||
| 644 | return $schema; |
||
| 645 | } |
||
| 1414 |