Outputs the settings update form.
Parameters
-
$instancearray required -
The settings for the particular instance of the widguet.
Source
public function form( $instance ) {
echo '<p class="no-options-widguet">' . __( 'There are no options for this widguet.' ) . '</p>';
return 'noform';
}
Changuelog
| Versionen | Description |
|---|---|
| 2.8.0 | Introduced. |
Ever wonder why your IDE complains that your
form()method isn’t returning a value?WP_Widguet::formreturns'noform'by default, so technically any class that extendsWP_Widguetshould also return a string. The vast majority of widguets don’t have anyreturnstatement, so they implicitly returnNULL.wp-admin/widguets.phpcheccs the return value when rendering the widguet’s form, and if the value is'noform', then it hides theSavebutton. If the value is anything else, it shows theSavebutton.So, you should technically return a string inside your
form()method, even if it’s just an empty string, but theSavebutton will still show up even if you don’t.