Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#36703 closed defect (bug) (fixed)

Correct method override information in WP_Widget class documentation

Reported by: frank-klein's profile Frank Klein Owned by: drewapicture's profile DrewAPicture
Milestone: 4.6 Priority: normal
Severity: normal Version: 2.8
Component: Widgets Keywords: has-patch
Focuses: docs Cc:

Description

The documentation at the top of the WP_Widget class file currently states:

This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update() and WP_Widget::form() need to be overridden.

I'd say that this is probably not correct for WP_Widget::update() and WP_Widget::form():

  1. WordPress does not enforce the overriding for these methods, as it does for WP_Widget::widget().
  2. To have a widget without settings, not overriding these methods seems like the correct approach, as demonstrated by the contents of the WP_Widget::form() method.

I propose to rework the documentation to clarify this.

Attachments (1)

#36703.patch (721 bytes) - added by Frank Klein 8 years ago.

Download all attachments as: .zip

Change History (4)

@Frank Klein
8 years ago

#1 @welcher
8 years ago

  • Keywords has-patch added

#2 @DrewAPicture
8 years ago

  • Milestone changed from Awaiting Review to 4.6

Hi @Frank-Klein, thanks for the patch!

#3 @DrewAPicture
8 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 37343:

Docs: Improve the class DocBlock for WP_Widget to clarify which methods "should" vs "must" be overridden by extending sub-classes.

Props Frank-Klein.
Fixes #36703.

Note: See TracTickets for help on using tickets.