Skip to content

Commit c4dc178

Browse files
author
Guido W. Pettinari
committed
View function obbligatoria
1 parent 1c43aec commit c4dc178

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "idearia/wordpress-settings-api-class",
33
"description": "WordPress settings API Abstraction Class",
4-
"keywords": ["wp","wordpress", "settings-api"],
4+
"keywords": ["wp", "wordpress", "settings-api"],
55
"type": "library",
66
"license": "GPL-3.0-or-later",
77
"homepage": "https://github.com/Idearia/wordpress-settings-api-class",

src/class-menu-page.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
namespace Idearia;
55

6-
defined( 'ABSPATH' ) || exit;
7-
86
/**
97
* Crea una pagina generica di menu in WordPress e mostrala come
108
* voce di menu a se stante oppure come sottovoce di un menu
@@ -79,6 +77,12 @@ abstract class MenuPage
7977
* Registra gli hooks
8078
*/
8179
public function __construct() {
80+
if ( ! $this->label ) {
81+
throw new \Exception( 'Label non definita!' );
82+
}
83+
if ( ! $this->slug ) {
84+
throw new \Exception( 'Slug non definita!' );
85+
}
8286
add_action( 'admin_menu', array( $this, 'admin_menu' ), $this->filterPriority );
8387
}
8488

@@ -107,9 +111,8 @@ public function admin_menu() {
107111
}
108112

109113
/**
110-
* Funzione usata per renderizzare l'HTML
114+
* Funzione usata per renderizzare l'HTML; deve fare
115+
* echo di qualcosa.
111116
*/
112-
public function view() {
113-
return 'Hello world!';
114-
}
117+
abstract public function view();
115118
}

0 commit comments

Comments
 (0)