Configuration Screens

As you saw in Chapter 2, some widgets have options. If yours does, you'll need to create a configuration screen.

Listing 8-14 is an expanded version of the Dashboard Notepad widget, this time with several options. You'll let the administrator change the widget title. You'll also put some role checking in place so that the administrator can decide who gets to edit the notes. The changes from Listing 8-13 are in bold. Figure 8-6 shows the resulting configuration screen.

Listing 8-14. Dashboard Notepad widget with options configuration screen function dashboard_notepad_widget() {

$options = dashboard_notepad_widget_options(); if (!empty($_POST['dashboard_notepad_submit']) ) {

$options['notes'] = stripslashes($_pOST['dashboard_notepad']); update_option('dashboard_notepad', $options);

Was this article helpful?

0 0

Post a comment