Skip to content

Commit

Permalink
#3 Auction Post Type (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget authored Dec 11, 2023
1 parent c0d5092 commit 903cb99
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 71 deletions.
4 changes: 2 additions & 2 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

<!-- Rules: Check PHP version compatibility - see
https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>
<!-- <rule ref="PHPCompatibilityWP"/>-->
<!-- For help in understanding this testVersion:
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="8.1-"/>
<!-- <config name="testVersion" value="8.1-"/>-->

<!-- Rules: VIP Coding Standards - see
https://github.com/Automattic/VIP-Coding-Standards -->
Expand Down
5 changes: 5 additions & 0 deletions client-mu-plugins/goodbids/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ Returns the array of custom fields, based on the given context (create, edit, or

`goodbids()->admin->render_field( string $key, array $field, string $prefix, array $data )`
Renders an admin field based on the given field array. The `$prefix` and `$data` parameters are optional, but required for some field types.

### Auction Functions

`goodbids()->auctions->get_post_type()`
Returns the auction post type slug.
92 changes: 65 additions & 27 deletions client-mu-plugins/goodbids/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 116 additions & 0 deletions client-mu-plugins/goodbids/group_6570c1fa76181.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"key": "group_6570c1fa76181",
"title": "Auction Settings",
"fields": [
{
"key": "field_657334958904f",
"label": "Auction Product",
"name": "auction_product",
"aria-label": "",
"type": "post_object",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"post_type": [
"product"
],
"post_status": [
"publish"
],
"taxonomy": "",
"return_format": "object",
"multiple": 0,
"allow_null": 0,
"bidirectional": 0,
"ui": 1,
"bidirectional_target": []
},
{
"key": "field_6570c1fb429a8",
"label": "Auction Start",
"name": "auction_start",
"aria-label": "",
"type": "date_time_picker",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"display_format": "m\/d\/Y g:i a",
"return_format": "Y-m-d H:i:s",
"first_day": 0
},
{
"key": "field_657334728904e",
"label": "Bid Increment",
"name": "bid_increment",
"aria-label": "",
"type": "number",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"min": "",
"max": "",
"placeholder": "",
"step": "",
"prepend": "$",
"append": ".00"
},
{
"key": "field_657334428904d",
"label": "Auction Goal",
"name": "auction_goal",
"aria-label": "",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"min": "",
"max": "",
"placeholder": "",
"step": "",
"prepend": "$",
"append": ".00"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "gb-auction"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1702068952,
"private": true
}
18 changes: 13 additions & 5 deletions client-mu-plugins/goodbids/src/classes/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace GoodBids;

use GoodBids\Admin\Admin;
use GoodBids\Auctions\Auctions;
use GoodBids\Network\Sites;
use GoodBids\Plugins\ACF;

Expand Down Expand Up @@ -53,6 +54,12 @@ class Core {
*/
public Admin $admin;

/**
* @since 1.0.0
* @var Auctions
*/
public Auctions $auctions;

/**
* Constructor
*
Expand Down Expand Up @@ -139,9 +146,9 @@ private function load_config() : bool {
*
* @param string $key Config Key.
*
* @return mixed|null
* @return mixed
*/
public function get_config( string $key ) {
public function get_config( string $key ) : mixed {
return $this->config[ $key ] ?? null;
}

Expand Down Expand Up @@ -193,9 +200,10 @@ private function load_modules() : void {
add_action(
'mu_plugin_loaded',
function () {
$this->acf = new ACF();
$this->sites = new Sites();
$this->admin = new Admin();
$this->acf = new ACF();
$this->sites = new Sites();
$this->admin = new Admin();
$this->auctions = new Auctions();
}
);
}
Expand Down
Loading

0 comments on commit 903cb99

Please sign in to comment.