Opened 9 years ago
Closed 3 years ago
#7696 closed defect (bug) (wontfix)
Widget markup should not have hardcoded `id` param
| Reported by: | boonebgorges | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | |
| Severity: | normal | Keywords: | good-first-bug needs-patch |
| Cc: |
Description
I've just noticed that at least one of our widget classes has hardcoded id attributes in the markup generated by widget(). This shouldn't happen. We should use $this->id to concatenate id attributes, in case someone wants to have more than one instance on a page. See eg https://buddypress.trac.wordpress.org/browser/tags/2.9.3/src/bp-groups/classes/class-bp-groups-widget.php?marks=120,130#L118 The rest of our widgets could use an audit for this.
We can minimize backward compatibility breaks by keeping the currently hardcoded IDs for the first instance on a page.
Our JS may also need a review for this - I'm not sure whether it references widget IDs or classes, but it should only use selectors.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Widgets were moved into BP Classic after being deprecated in favor of blocks.