SMF Development > Feature Requests
template_button_strip: 'active' parameter check
Yoshi:
SMF version: 2.0.2
When using template_button_strip, the active parameter of the buttons are just checked for their existance -- you can put 'active' => 'you are a fat asshole' there and it'll still be active.
Some people like me want to be able to perform checks on that parameter, like 'active' => $context['blah_this_may_be_false_or_true']
Could this be implemented? I have to do this walkaround right now:
--- Code: ---if (blah)
$buttons['button_name']['active'] = true;
--- End code ---
Which isn't the most beautiful code.
IchBin™:
isset($value['active']) should be empty($value['active']). Then you can do a true/false check properly. If the variable is set to false isset() doesn't care. empty() verifies if true or false.
TE:
mhh, maybe I don't get it but what would prevent you from using something like this:
--- Code: ---'active' => $context['blablabla'] == 'This is a test' ? true : false,
--- End code ---
Yoshi:
--- Quote from: Thorsten Eurich on August 29, 2012, 01:52:47 PM ---mhh, maybe I don't get it but what would prevent you from using something like this:
--- Code: ---'active' => $context['blablabla'] == 'This is a test' ? true : false,
--- End code ---
--- End quote ---
If you do that, it'll be active regardless if the value of it is false.
So if it is
--- Code: ---'active' => false,
--- End code ---
it'll still be active.
This is because the functio nchecks if the key is set, but it doesn't check what value it has (e.g. false or true)
TE:
I see, checked the function in index.template.php (should have checked it before :P)
+ for the request, should definitely be changed.
Navigation
[0] Message Index
[#] Next page
Go to full version