Skip to content

Commit

Permalink
Update class names, add position attribute to sub menu page
Browse files Browse the repository at this point in the history
  • Loading branch information
kofimokome committed Jan 31, 2022
1 parent b667c96 commit 69b1f69
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
.idea/
*.DS_Store
8 changes: 4 additions & 4 deletions MenuPage.php → KMMenuPage.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
* User: kofi
* Date: 6/5/19
* Time: 11:59 AM
* @version 1.0.1
* @version 1.0.2
* @author kofi mokome
*/


class MenuPage {
class KMMenuPage {
private $page_title;
private $menu_title;
private $capability;
Expand Down Expand Up @@ -88,11 +87,12 @@ public function get_menu_slug() {
}

/**
* @param SubMenuPage $sub_menu_page
* @param KMSubMenuPage $sub_menu_page
*
* @since 1.0.0
*/
public function add_sub_menu_page( $sub_menu_page ) {
$sub_menu_page->set_parent_slug( $this->menu_slug );
array_push( $this->sub_menu_pages, $sub_menu_page );
}

Expand Down
18 changes: 14 additions & 4 deletions SubMenuPage.php → KMSubMenuPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
* Date: 6/5/19
* Time: 12:41 PM
* @author kofi mokome
* @version 1.0.1
* @version 1.0.2
*/


class SubMenuPage {
class KMSubMenuPage {
private $page_title;
private $menu_title;
private $capability;
private $menu_slug;
private $parent_slug;
private $function;
private $position;
private $tabs;

/**
Expand All @@ -30,6 +30,7 @@ public function __construct( $data ) {
'menu_title' => '',
'capability' => '',
'menu_slug' => '',
'position' => null,
'function' => null,
'use_tabs' => false
);
Expand All @@ -39,6 +40,7 @@ public function __construct( $data ) {
$this->menu_title = $data['menu_title'];
$this->capability = $data['capability'];
$this->menu_slug = $data['menu_slug'];
$this->position = $data['position'];
$this->parent_slug = $data['parent_slug'];
$this->function = $data['function'];
if ( $data['use_tabs'] ) {
Expand Down Expand Up @@ -114,9 +116,17 @@ public function create_sub_menu_page() {
$this->menu_title,
$this->capability,
$this->menu_slug,
$this->function
$this->function,
$this->position
);
}

/**
* @since 1.0.1
*/
public function set_parent_slug( $slug ) {
$this->parent_slug = $slug;
}
}


Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ $messages_page = new SubMenuPage(
'menu_title' => 'Blocked Messages',
'capability' => 'manage_options',
'menu_slug' => 'kmcf7-filtered-messages',
'position' => 1
'function' => array(
$this,
'messages_view'
Expand Down

0 comments on commit 69b1f69

Please sign in to comment.