Opened 17 years ago
Closed 17 years ago
#6108 closed defect (bug) (fixed)
In admin, current widgets should show something more identifiable than the type of widget
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Administration | Keywords: | widgets has-patch 2nd-opnion |
Focuses: | Cc: |
Description
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.
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.
Cons: A lot of code change, much of which is a bit hacky.
Attachments (2)
Change History (7)
#3
@
17 years ago
This is good to go in, but for some reason my fickle patch tool will not apply it. Could it be done as a single patch? I don't want to screw it up applying by hand.
JS Patch