Skip to content

Commit

Permalink
Added menu_order option to group
Browse files Browse the repository at this point in the history
  • Loading branch information
sincspecv authored Apr 23, 2020
1 parent 4bf3506 commit f0a23b6
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion classes/Base/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class Group {
* @var $hidden_elements array
*/
protected $hidden_elements;


/*
* Menu order option
*
* @var $order int
*/
protected $order;

/**
* Group parameters
Expand Down Expand Up @@ -111,6 +117,7 @@ public function getArray() {
'fields' => $this->getFields(),
'location' => $this->getLocations(),
'hide_on_screen' => isset( $this->hidden_elements ) ? $this->hidden_elements : [],
'menu_order' => $this->getOrder(),
];
}

Expand Down Expand Up @@ -305,4 +312,22 @@ public function getLocations() {

return [$results];
}

/**
* Set the menu_order option
*
* @param int $order
*/
protected function setOrder($order = 0) {
$this->order = (int)$order;
}

/**
* Get the menu_order option. Returns 0 if not set.
*
* @return int
*/
protected function getOrder() {
return empty($this->order) ? 0 : $this->order;
}
}

0 comments on commit f0a23b6

Please sign in to comment.