Field caps removed from product raw price and description fields.

This commit is contained in:
Geoff Taylor
2020-08-11 19:36:47 -04:00
parent 3b7bd5d311
commit fe46ea088f
6 changed files with 7104 additions and 61 deletions
+29 -61
View File
@@ -231,22 +231,16 @@ class Product extends Crud_CPT {
'purchasable' => function () {
return ! is_null( $this->data->is_purchasable() ) ? $this->data->is_purchasable() : null;
},
'descriptionRaw' => function() {
return ! empty( $this->data->get_description() ) ? $this->data->get_description() : null;
},
'shortDescriptionRaw' => function() {
return ! empty( $this->data->get_short_description() ) ? $this->data->get_short_description() : null;
},
/**
* Editor/Shop Manager only fields
*/
'descriptionRaw' => array(
'callback' => function() {
return ! empty( $this->data->get_description() ) ? $this->data->get_description() : null;
},
'capability' => $this->post_type_object->cap->edit_posts,
),
'shortDescriptionRaw' => array(
'callback' => function() {
return ! empty( $this->data->get_short_description() ) ? $this->data->get_short_description() : null;
},
'capability' => $this->post_type_object->cap->edit_posts,
),
'catalogVisibility' => array(
'callback' => function() {
return ! empty( $this->data->get_catalog_visibility() ) ? $this->data->get_catalog_visibility() : null;
@@ -302,49 +296,36 @@ class Product extends Crud_CPT {
);
if ( 'grouped' !== $this->data->get_type() ) {
$shared_fields['price'] = function() {
$shared_fields['price'] = function() {
return ! empty( $this->data->get_price() )
? \wc_graphql_price( $this->data->get_price() )
: null;
};
$shared_fields['regularPrice'] = function() {
$shared_fields['regularPrice'] = function() {
return ! empty( $this->data->get_regular_price() )
? \wc_graphql_price( $this->data->get_regular_price() )
: null;
};
$shared_fields['salePrice'] = function() {
$shared_fields['salePrice'] = function() {
return ! empty( $this->data->get_sale_price() )
? \wc_graphql_price( $this->data->get_sale_price() )
: null;
};
$shared_fields['taxStatus'] = function() {
$shared_fields['taxStatus'] = function() {
return ! empty( $this->data->get_tax_status() ) ? $this->data->get_tax_status() : null;
};
$shared_fields['taxClass'] = function() {
$shared_fields['taxClass'] = function() {
return ! is_null( $this->data->get_tax_class() ) ? $this->data->get_tax_class() : '';
};
/**
* Editor/Shop Manager only fields
*/
$shared_fields['priceRaw'] = array(
'callback' => function() {
return ! empty( $this->data->get_price() ) ? $this->data->get_price() : null;
},
'capability' => $this->post_type_object->cap->edit_posts,
);
$shared_fields['regularPriceRaw'] = array(
'callback' => function() {
return ! empty( $this->data->get_regular_price() ) ? $this->data->get_regular_price() : null;
},
'capability' => $this->post_type_object->cap->edit_posts,
);
$shared_fields['salePriceRaw'] = array(
'callback' => function() {
return ! empty( $this->data->get_sale_price() ) ? $this->data->get_sale_price() : null;
},
'capability' => $this->post_type_object->cap->edit_posts,
);
$shared_fields['priceRaw'] = function() {
return ! empty( $this->data->get_price() ) ? $this->data->get_price() : null;
};
$shared_fields['regularPriceRaw'] = function() {
return ! empty( $this->data->get_regular_price() ) ? $this->data->get_regular_price() : null;
};
$shared_fields['salePriceRaw'] = function() {
return ! empty( $this->data->get_sale_price() ) ? $this->data->get_sale_price() : null;
};
}
if ( 'simple' === $this->data->get_type() || 'variable' === $this->data->get_type() ) {
@@ -431,28 +412,15 @@ class Product extends Crud_CPT {
? array_map( 'absint', $this->data->get_children() )
: array( '0' );
},
/**
* Editor/Shop Manager only fields
*/
'priceRaw' => array(
'callback' => function() {
return $this->get_variation_price( '', true );
},
'capability' => $this->post_type_object->cap->edit_posts,
),
'regularPriceRaw' => array(
'callback' => function() {
return $this->get_variation_price( 'regular', true );
},
'capability' => $this->post_type_object->cap->edit_posts,
),
'salePriceRaw' => array(
'callback' => function() {
return $this->get_variation_price( 'sale', true );
},
'capability' => $this->post_type_object->cap->edit_posts,
),
'priceRaw' => function() {
return $this->get_variation_price( '', true );
},
'regularPriceRaw' => function() {
return $this->get_variation_price( 'regular', true );
},
'salePriceRaw' => function() {
return $this->get_variation_price( 'sale', true );
},
);
break;
case 'external':
File diff suppressed because it is too large Load Diff
+44
View File
@@ -6,6 +6,50 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'ba366f96f4fddbdef61ad7a862b44f61' => $vendorDir . '/wp-cli/package-command/package-command.php',
'be01b9b16925dcb22165c40b46681ac6' => $vendorDir . '/wp-cli/php-cli-tools/lib/cli/cli.php',
'3937806105cc8e221b8fa8db5b70d2f2' => $vendorDir . '/wp-cli/mustangostang-spyc/includes/functions.php',
'd979c11fe80ba96ae3037b43429fe546' => $vendorDir . '/wp-cli/scaffold-command/scaffold-command.php',
'3f201033d5aceb2293314273be88f7c6' => $vendorDir . '/wp-cli/extension-command/extension-command.php',
'5e099d3cac677dd2bec1003ea7707745' => $vendorDir . '/wp-cli/media-command/media-command.php',
'f3f0199a3ecd9f501d0a3b361bd2f61c' => $vendorDir . '/wp-cli/entity-command/entity-command.php',
'c65f753375faee349b7adc48c2ee7cc2' => $vendorDir . '/wp-cli/db-command/db-command.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'30cbb6e4122dc988e494c6b9c0438233' => $vendorDir . '/wp-cli/import-command/import-command.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'b66d29757fcb2fb7a9608d068e3716b0' => $vendorDir . '/wp-cli/checksum-command/checksum-command.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'5c6ec5cff8f9d625772c8ed147f6b894' => $vendorDir . '/wp-cli/export-command/export-command.php',
'ac949ce40a981819ba132473518a9a31' => $vendorDir . '/wp-cli/wp-config-transformer/src/WPConfigTransformer.php',
'8a0ad02df6a5087f2c380f8fd52db273' => $vendorDir . '/wp-cli/cache-command/cache-command.php',
'72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',
'1f05372afcc7d0c51a305cef1d56dd01' => $vendorDir . '/wp-cli/widget-command/widget-command.php',
'8519779bbb65eeb842af2f629ce7b6f8' => $vendorDir . '/wp-cli/super-admin-command/super-admin-command.php',
'129d58fa8151374aceb8571bcaa97504' => $vendorDir . '/wp-cli/shell-command/shell-command.php',
'9f04dd0aa5d67ec75a75c88c345a079e' => $vendorDir . '/wp-cli/server-command/server-command.php',
'8ecb13f8bbc22b1b34d12b14ec01077a' => $vendorDir . '/wp-cli/search-replace-command/search-replace-command.php',
'080fadd667195d055c5a23386f270261' => $vendorDir . '/wp-cli/role-command/role-command.php',
'f399c1c8d0c787d5c94c09884cdd9762' => $vendorDir . '/wp-cli/rewrite-command/rewrite-command.php',
'1c88c1eff05217a8cac80c64c9ac2080' => $vendorDir . '/wp-cli/maintenance-mode-command/maintenance-mode-command.php',
'ace0d205db7f4135ec32132a0076d555' => $vendorDir . '/wp-cli/language-command/language-command.php',
'ffb465a494c3101218c4417180c2c9a2' => $vendorDir . '/wp-cli/i18n-command/i18n-command.php',
'f958dca3f412fd7975da1700912a9321' => $vendorDir . '/wp-cli/eval-command/eval-command.php',
'021d3a13471556f0b57038d679f7f8ea' => $vendorDir . '/wp-cli/embed-command/embed-command.php',
'7654e00bf0e632580764400bd8293a9c' => $vendorDir . '/wp-cli/cron-command/cron-command.php',
'68c39b88215b6cf7a0da164166670ef9' => $vendorDir . '/wp-cli/core-command/core-command.php',
'5deaf6ce9c8bbdfb65104c7e938d5875' => $vendorDir . '/wp-cli/config-command/config-command.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'e2b8090921f5e293ca4eb0c107749811' => $vendorDir . '/lucatume/wp-browser/src/tad/WPBrowser/functions.php',
'944484f100dc1864a5320474d49ebd5a' => $baseDir . '/includes/connection/wc-cpt-connection-args.php',
'45a15019e901000ab8608c03ebff44fb' => $baseDir . '/includes/functions.php',
'e873b70ed56804979eba7de676fd9a7f' => $baseDir . '/tests/_data/config.php',
);
+9
View File
@@ -6,4 +6,13 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'cli' => array($vendorDir . '/wp-cli/php-cli-tools/lib'),
'WP_CLI' => array($vendorDir . '/wp-cli/wp-cli/php'),
'Requests' => array($vendorDir . '/rmccue/requests/library'),
'Oxymel' => array($vendorDir . '/nb/oxymel'),
'Mustache' => array($vendorDir . '/mustache/mustache/src'),
'Hautelook' => array($vendorDir . '/hautelook/phpass/src'),
'Handlebars' => array($vendorDir . '/xamin/handlebars.php/src'),
'Behat\\Gherkin' => array($vendorDir . '/behat/gherkin/src'),
'BaconStringUtils' => array($vendorDir . '/bacon/bacon-string-utils/src'),
);
+70
View File
@@ -6,6 +6,76 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku'),
'tad\\' => array($vendorDir . '/lucatume/wp-browser-commons/src/tad', $vendorDir . '/lucatume/wp-browser/src/tad'),
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'),
'cweagans\\Composer\\' => array($vendorDir . '/cweagans/composer-patches/src'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'WP_CLI\\MaintenanceMode\\' => array($vendorDir . '/wp-cli/maintenance-mode-command/src'),
'WP_CLI\\I18n\\' => array($vendorDir . '/wp-cli/i18n-command/src'),
'WP_CLI\\Embeds\\' => array($vendorDir . '/wp-cli/embed-command/src'),
'WP_CLI\\' => array($vendorDir . '/wp-cli/shell-command/src/WP_CLI', $vendorDir . '/wp-cli/entity-command/src/WP_CLI'),
'WPGraphQL\\WooCommerce\\' => array($baseDir . '/includes'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\DomCrawler\\' => array($vendorDir . '/symfony/dom-crawler'),
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'),
'Symfony\\Component\\BrowserKit\\' => array($vendorDir . '/symfony/browser-kit'),
'Stripe\\' => array($vendorDir . '/stripe/stripe-php/lib'),
'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'),
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
'PhpCoveralls\\' => array($vendorDir . '/simpod/php-coveralls-mirror/src'),
'Peast\\test\\' => array($vendorDir . '/mck89/peast/test/Peast'),
'Peast\\' => array($vendorDir . '/mck89/peast/lib/Peast'),
'Mustangostang\\' => array($vendorDir . '/wp-cli/mustangostang-spyc/src'),
'MikeMcLin\\WpPassword\\' => array($vendorDir . '/mikemclin/laravel-wp-password/src'),
'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Gumlet\\' => array($vendorDir . '/gumlet/php-image-resize/lib'),
'Gettext\\Languages\\' => array($vendorDir . '/gettext/languages/src'),
'Gettext\\' => array($vendorDir . '/gettext/gettext/src'),
'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
'Facebook\\WebDriver\\' => array($vendorDir . '/facebook/webdriver/lib'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Inflector'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
'Composer\\' => array($vendorDir . '/composer/composer/src/Composer'),
'Codeception\\PHPUnit\\' => array($vendorDir . '/codeception/phpunit-wrapper/src'),
'Codeception\\Extension\\' => array($vendorDir . '/codeception/codeception/ext'),
'Codeception\\' => array($vendorDir . '/codeception/stub/src', $vendorDir . '/codeception/codeception/src/Codeception', $vendorDir . '/lucatume/wp-browser/src/Codeception'),
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
'' => array($vendorDir . '/wp-cli/widget-command/src', $vendorDir . '/wp-cli/super-admin-command/src', $vendorDir . '/wp-cli/shell-command/src', $vendorDir . '/wp-cli/server-command/src', $vendorDir . '/wp-cli/search-replace-command/src', $vendorDir . '/wp-cli/scaffold-command/src', $vendorDir . '/wp-cli/role-command/src', $vendorDir . '/wp-cli/rewrite-command/src', $vendorDir . '/wp-cli/package-command/src', $vendorDir . '/wp-cli/media-command/src', $vendorDir . '/wp-cli/language-command/src', $vendorDir . '/wp-cli/import-command/src', $vendorDir . '/wp-cli/extension-command/src', $vendorDir . '/wp-cli/export-command/src', $vendorDir . '/wp-cli/eval-command/src', $vendorDir . '/wp-cli/entity-command/src', $vendorDir . '/wp-cli/db-command/src', $vendorDir . '/wp-cli/cron-command/src', $vendorDir . '/wp-cli/core-command/src', $vendorDir . '/wp-cli/config-command/src', $vendorDir . '/wp-cli/checksum-command/src', $vendorDir . '/wp-cli/cache-command/src'),
);
File diff suppressed because it is too large Load Diff