actions
2 years ago
interfaces
2 years ago
settings
2 years ago
action-pages-manager.php
2 years ago
addons-page.php
2 years ago
base-page.php
2 years ago
pages-manager.php
1 year ago
single-pages-manager.php
2 years ago
stable-pages-manager.php
1 year ago
base-page.php
67 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Jet_Form_Builder\Admin\Pages; |
| 4 | |
| 5 | use JFB_Components\Admin\Page\Interfaces\Admin_Dashboard_Page_It; |
| 6 | use Jet_Form_Builder\Admin\Exceptions\Not_Found_Page_Exception; |
| 7 | use JFB_Components\Admin\Page\Traits\Admin_Dashboard_Page_Trait; |
| 8 | use JFB_Components\Admin\Vui_Boxes\Traits\With_Boxes_Trait; |
| 9 | use JFB_Components\Repository\Repository_Item_Instance_Trait; |
| 10 | use Jet_Form_Builder\Classes\Theme\With_Theme_Info; |
| 11 | use JFB_Components\Admin\Notices\Traits\With_Notices_Trait; |
| 12 | |
| 13 | // If this file is called directly, abort. |
| 14 | if ( ! defined( 'WPINC' ) ) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Base dashboard page |
| 20 | */ |
| 21 | abstract class Base_Page implements |
| 22 | Repository_Item_Instance_Trait, |
| 23 | Admin_Dashboard_Page_It { |
| 24 | |
| 25 | use Admin_Dashboard_Page_Trait; |
| 26 | use With_Notices_Trait; |
| 27 | use With_Theme_Info; |
| 28 | use With_Boxes_Trait; |
| 29 | |
| 30 | public function rep_item_id(): string { |
| 31 | return $this->slug(); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * If it returns FALSE, this page is not registered |
| 36 | * |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function is_active(): bool { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @throws Not_Found_Page_Exception |
| 45 | */ |
| 46 | public function render() { |
| 47 | Pages_Manager::instance()->get_current()->render_page(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Returns current page url |
| 52 | * |
| 53 | * @param array $query_args |
| 54 | * |
| 55 | * @return string |
| 56 | */ |
| 57 | public function get_url( $query_args = array() ): string { |
| 58 | return $this->admin_url( |
| 59 | array_merge( |
| 60 | array( 'page' => $this->slug() ), |
| 61 | $query_args |
| 62 | ) |
| 63 | ); |
| 64 | } |
| 65 | |
| 66 | } |
| 67 |