I think those are valid arguments, and I agree with them. But shouldn't we take those arguments to Trac or wpdevel or somewhere? From the perspective of Theme development, I'm simply looking at it as, "core has implemented it this way, so here's a heads-up for how we should probably be implementing it, too".<div>
<br></div><div>In other words: we're mostly just downstream of core decisions here.<br><div><br></div><div>(And feel free to pick on me; I'm pretty thick-skinned. ;) )</div><div><br></div><div>Chip<br><br><div class="gmail_quote">
On Mon, Jul 25, 2011 at 10:00 PM, Doug Stewart <span dir="ltr"><<a href="mailto:zamoose@gmail.com">zamoose@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Then let's go the whole way: pass a simple array to a theme options<br>
page and have core generate ALL the markup -- everything else is just<br>
dalliance.<br>
<br>
And again, not to pick on you Chip, but the plain meaning of the<br>
template tag just isn't, well, *plain* to a non-initiate.<br>
<br>
Shouldn't it be "print_submit_button()" or "display_submit_button()"?<br>
"submit_button()" suggests that it's submitting something related to a<br>
button, *NOT* outputting code.<br>
<div><div></div><div class="h5"><br>
On Mon, Jul 25, 2011 at 10:55 PM, Chip Bennett <<a href="mailto:chip@chipbennett.net">chip@chipbennett.net</a>> wrote:<br>
> I totally agree with the namespacing thing. I wish core would practice what<br>
> it preaches just a bit better with these kinds of functions.<br>
> But, my example was intentionally complex. Basic examples are pretty<br>
> straightforward:<br>
> <?php submit_button( $button_text, $button_type, $name, $wrapper ); ?><br>
> $button_text: button text<br>
> $button_type: 'primary' or 'secondary' (actually, quite useful, as it helps<br>
> ensure button style fits WP UI)<br>
> $name: name attribute<br>
> $wrapper: (boolean) whether or not to wrap button in <p> tags.<br>
> So:<br>
><br>
> <?php submit_button( "Save Settings", 'primary', 'submit' ); ?><br>
> <?php submit_button( "Reset Defaults", 'secondary', 'reset' ); ?><br>
><br>
> Is all you really need.<br>
> And in the first case, you can even get away with:<br>
><br>
> <?php submit_button(); ?><br>
><br>
> No need to pass any arguments whatsoever.<br>
> If I had to guess, I would guess that the objective here is to abstract away<br>
> as much of the settings form markup as absolutely possible - which is an<br>
> objective that I would actually agree with. By abstracting the form markup,<br>
> it becomes MUCH easier to make UI changes in the future, in a way that will<br>
> ensure forward-compatibility for existing code.<br>
> Chip<br>
> On Mon, Jul 25, 2011 at 9:39 PM, Doug Stewart <<a href="mailto:zamoose@gmail.com">zamoose@gmail.com</a>> wrote:<br>
>><br>
>> Okay, need to get this off my chest:<br>
>> This particular example + the checked()/selected() stuff has been<br>
>> driving me batty. They're examples of over-complication on WordPress'<br>
>> part when perfectly viable pure PHP/HTML solutions are tried, true,<br>
>> tested and far more approachable.<br>
>><br>
>> I mean, seriously, look at Chip's code (and not to single him out,<br>
>> it's just the only code to point to here): it's complicated and<br>
>> unusable/unapproachable without an XRef for the possible arguments. At<br>
>> least in the past, a person with PHP experience had a chance to read a<br>
>> simple ternary statment (in the case of checked()/selected()) or a<br>
>> person with HTML savvy can read the plain meaning of the Submit<br>
>> buttons. It's cleverness at the expense of readability/approachability<br>
>> and I think it's a mistake.<br>
>><br>
>> Plus they're not even namespaced.<br>
>><br>
>> Gah.<br>
>><br>
>> Just my $.02.<br>
>><br>
>> On Mon, Jul 25, 2011 at 12:58 PM, Chip Bennett <<a href="mailto:chip@chipbennett.net">chip@chipbennett.net</a>><br>
>> wrote:<br>
>> > The submit_button() function is flexible enough to handle resetting to<br>
>> > defaults. :)<br>
>> > For example, here's my old code from Oenology (note that I pass a "tab"<br>
>> > name<br>
>> > to the button name attribute):<br>
>> ><br>
>> > <input name="theme_oenology_options[submit-<?php echo $tab; ?>]"<br>
>> > type="submit" class="button-primary" value="Save Settings" /><br>
>> > <input name="theme_oenology_options[reset-<?php echo $tab; ?>]"<br>
>> > type="submit" class="button-secondary" value="Reset Defaults" /><br>
>> ><br>
>> > And here's the replacement code:<br>
>> ><br>
>> > <?php submit_button( __( 'Save Settings', 'oenology' ), 'primary',<br>
>> > 'theme_oenology_options[submit-' . $tab . ']', false ); ?><br>
>> > <?php submit_button( __( 'Reset Defaults', 'oenology' ), 'secondary',<br>
>> > 'theme_oenology_options[reset-' . $tab . ']', false ); ?><br>
>> ><br>
>> > The rendered output is exactly the same in both cases.<br>
>> > Assuming that your "reset defaults" functionality looks at the NAME<br>
>> > attribute as part of the $_POST data passed to $input, then you're good<br>
>> > to<br>
>> > go.<br>
>> > Chip<br>
>> ><br>
>> > On Mon, Jul 25, 2011 at 11:44 AM, George Mamadashvili<br>
>> > <<a href="mailto:georgemamadashvili@gmail.com">georgemamadashvili@gmail.com</a>> wrote:<br>
>> >><br>
>> >> Hello Chip.<br>
>> >> I noticed that function too and liked it, but if theme author what to<br>
>> >> provide "Reset to Default" button, does it still need to be hard-coded?<br>
>> >> I<br>
>> >> had no to dig in this function, can we this function for reset button<br>
>> >> too?<br>
>> >> Best<br>
>> >> George<br>
>> >><br>
>> >> On Mon, Jul 25, 2011 at 8:25 PM, Chip Bennett <<a href="mailto:chip@chipbennett.net">chip@chipbennett.net</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> Good morning developers/reviewers!<br>
>> >>> Just a note, from something that I noticed being used in Twenty<br>
>> >>> Eleven:<br>
>> >>> the submit_button() function, which replaces hard-coded form submit<br>
>> >>> buttons.<br>
>> >>> I would strongly recommend making use of it in Theme Settings Page<br>
>> >>> forms;<br>
>> >>> as with other "doing things the core-supported way" criteria, I would<br>
>> >>> expect<br>
>> >>> this one to show up in the Guidelines at some point in the future.<br>
>> >>> Chip<br>
>> >>> _______________________________________________<br>
>> >>> theme-reviewers mailing list<br>
>> >>> <a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
>> >>> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
>> >>><br>
>> >><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> theme-reviewers mailing list<br>
>> >> <a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
>> >> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
>> >><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > theme-reviewers mailing list<br>
>> > <a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
>> > <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
>> ><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> -Doug<br>
>> _______________________________________________<br>
>> theme-reviewers mailing list<br>
>> <a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
>> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
><br>
><br>
> _______________________________________________<br>
> theme-reviewers mailing list<br>
> <a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
-Doug<br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
</div></div></blockquote></div><br></div></div>