Permalink
Browse files

Update the widget to make sure it works with the_widget() without err…

…ors. Other minor cleanup.

git-svn-id: http://svn.locallylost.com/themes/hybrid-core/trunk@997 dba0f204-706d-4bc1-bc29-8b92e0485636
  • Loading branch information...
1 parent 88d0002 commit d251849221e01a9deb791e3a040867683858068d greenshady committed Feb 28, 2012
Showing with 12 additions and 21 deletions.
  1. +12 −21 classes/widget-nav-menu.php
@@ -16,12 +16,12 @@
* Nav Menu Widget Class
*
* @since 0.8.0
- * @link http://themehybrid.com/themes/hybrid/widgets
*/
class Hybrid_Widget_Nav_Menu extends WP_Widget {
/**
* Set up the widget's unique name, ID, class, description, and other options.
+ *
* @since 1.2.0
*/
function __construct() {
@@ -49,28 +49,17 @@ function __construct() {
/**
* Outputs the widget based on the arguments input through the widget controls.
+ *
* @since 0.8.0
*/
- function widget( $args, $instance ) {
- extract( $args );
-
- /* Set up the arguments for the wp_nav_menu() function. */
- $args = array(
- 'menu' => $instance['menu'],
- 'container' => $instance['container'],
- 'container_id' => $instance['container_id'],
- 'container_class' => $instance['container_class'],
- 'menu_id' => $instance['menu_id'],
- 'menu_class' => $instance['menu_class'],
- 'link_before' => $instance['link_before'],
- 'link_after' => $instance['link_after'],
- 'before' => $instance['before'],
- 'after' => $instance['after'],
- 'depth' => intval( $instance['depth'] ),
- 'fallback_cb' => $instance['fallback_cb'],
- 'walker' => $instance['walker'],
- 'echo' => false
- );
+ function widget( $sidebar, $instance ) {
+ extract( $sidebar );
+
+ /* Set the $args for wp_nav_menu() to the $instance array. */
+ $args = $instance;
+
+ /* Overwrite the $echo argument and set it to false. */
+ $args['echo'] = false;
/* Output the theme's widget wrapper. */
echo $before_widget;
@@ -88,6 +77,7 @@ function widget( $args, $instance ) {
/**
* Updates the widget control options for the particular instance of the widget.
+ *
* @since 0.8.0
*/
function update( $new_instance, $old_instance ) {
@@ -109,6 +99,7 @@ function update( $new_instance, $old_instance ) {
/**
* Displays the widget control options in the Widgets admin screen.
+ *
* @since 0.8.0
*/
function form( $instance ) {

0 comments on commit d251849

Please sign in to comment.