[wp-trac] [WordPress Trac] #6108: In admin,
current widgets should show something more identifiable than the
type of widget
WordPress Trac
wp-trac at lists.automattic.com
Thu Mar 6 01:57:44 GMT 2008
#6108: In admin, current widgets should show something more identifiable than the
type of widget
----------------------------+-----------------------------------------------
Reporter: mdawaffe | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.5
Component: Administration | Version: 2.5
Severity: normal | Keywords: widgets has-patch 2nd-opnion
----------------------------+-----------------------------------------------
Currently, if you have multiple text widgets, you just see them listed as
"Text", "Text", ... in the "Current Widgets" section.
It'd be nice if the widgets instead were listed as "Text: foo", "Text:
bar", ... where 'foo' and 'bar' are taken from the widget's title or
content or something (for all widgets, not just text widgets).
Attached are two patches. Both output titles as "{widget_type}:
{extracted_text}". The first patch accomplishes this via JS, the second
via PHP.
----
JS Patch:
Each widget in the "Current Widgets" section is scanned for visible text
inputs and textareas. If any are found, the first 22 text characters of
the first input element found are used as the {extracted_text}.
Pros: Not much code change.[[BR]]
Cons: Not super robust.
----
PHP Patch:
The display of the "Current Widgets" section is switched to a hacked
{{{dynamic_sidebar()}}} (similar in concept to the dashboard widgets
code). While displaying each widget control form, the on-blog widget
itself is output_buffered and its title extracted for use as the
{extracted_text}.
The use of the {{{dynamic_sidebar}}} and output buffering is necessary
because WP has no way of determining the title that will be displayed on-
blog of some random widget; widget's neither store nor output their
content in any standard way.
Pros: More robust. If a widget outputs a title on-blog, this code will
catch it.[[BR]]
Cons: A lot of code change, much of which is a bit hacky.
--
Ticket URL: <http://trac.wordpress.org/ticket/6108>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list