#22919 closed defect (bug) (fixed)
Gallery shortcode columns attribute present, even when default
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5.1 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Media | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
I love new media! Anyway, the default columns value is 3, so here's a scenario:
- Add a new post
- Hit Add Media, Create Gallery, select a few images and hit insert. Switch to Text mode. You'll see the gallery shortcode has been inserted with only the
ids
attribute, which is expected. - Make sure you're in Visual mode. Select the Gallery and hit the little Edit Gallery button, set Columns to 5, hit Update Gallery and switch to Text mode. You'll see that the gallery shortcode now also has
columns="5"
which is expected. - Edit the gallery again and set Columns back to 3. Hit Update and switch to Text. You'll see the shortcode has
columns="3"
but expected to see nocolumns
attribute since 3 is the default.
The same behavior happens on the link
attribute. The "correct" behavior happens on the orderby="rand"
attribute, which is removed from the shortcode when set to the default (off) state.
Attachments (1)
Change History (10)
#3
follow-up:
↓ 4
@
12 years ago
- Keywords commit added
- Owner set to koopersmith
- Status changed from new to reviewing
Looks good.
#5
@
12 years ago
Just thinking out loud here: What if the default changes in the future? If a user specifically chooses "3" maybe the parameter should actually stay?
#6
@
12 years ago
i would probably agree, but i think the idea is to insert a shortcode that contains only information that's required. i agree this ties the defaults down, changing them would break any shortcodes without a hard coded value.
by extension, i think your logic would suggest inserting the default values for all options when inserting the gallery in the first place, which would be pretty excessive.
i could not reproduce the error with the link attribute.
changed default value to string from int, correcting failed comparison (on line 251)