# |
Jun 28th 2018, 14:59 |
josbeir |
no |
# |
Jun 28th 2018, 14:59 |
kunalspunjabi |
@josbeir was that for me? templateVars |
# |
Jun 28th 2018, 14:49 |
josbeir |
(y) |
# |
Jun 28th 2018, 14:47 |
lubos |
OK. thanks both :slightly_smiling_face: testing |
# |
Jun 28th 2018, 14:47 |
slackebot4 |
select, not sure if that works for radio though |
# |
Jun 28th 2018, 14:47 |
tim |
``` $percentages = $this->Products->VatPercentages->find('all', ['order' => ['percentage' => 'ASC']])->toArray(); $vatPercentages = []; foreach($percentages as $percentage) { // We need the percentage value to calculate the prices with JavaScript $vatPercentages[] = [ 'text' => $percentage['name'], 'value' => $percentage['id'], 'data-value' => $percentage['percentage'] ]; }``` That's what I used for a |
# |
Jun 28th 2018, 14:46 |
josbeir |
https://book.cakephp.org/3.0/en/views/helpers/form.html#adding-additional-template-variables-to-templates |
# |
Jun 28th 2018, 14:46 |
josbeir |
check how RadioWidget.php works internally |
# |
Jun 28th 2018, 14:44 |
josbeir |
you can use the templateVars option to set extra suff on the radio element itself |
# |
Jun 28th 2018, 14:44 |
kunalspunjabi |
@generitter checking |
# |
Jun 28th 2018, 14:43 |
josbeir |
'radio' => '<input type="radio" name="{{name}}" value="{{value}}"{{attrs}}>', |
# |
Jun 28th 2018, 14:43 |
josbeir |
you can override the template of the radio element |
# |
Jun 28th 2018, 14:43 |
generitter |
@kunalspunjabi Did you look at beforeRender in components? Possible you removed something doing the upgrade. |
# |
Jun 28th 2018, 14:42 |
lubos |
@josbeir re outcome, let's say I have radio output with yes, no and for "no" i need data-error attribute so I can hadle javascript message when that option is selected |
# |
Jun 28th 2018, 14:42 |
kunalspunjabi |
@generitter - @josbeir thought this was the problem too but its not. beforeRender gets called. No variables are being passed from my AppController to my views |
# |
Jun 28th 2018, 14:40 |
generitter |
@kunalspunjabi isProduction, you might check to ensure the code that was in previous beforeRender calls in you 2x components and what not is still firing. |
# |
Jun 28th 2018, 14:40 |
josbeir |
what wou be your ideal outcome? |
# |
Jun 28th 2018, 14:40 |
josbeir |
depending on what you want to do |
# |
Jun 28th 2018, 14:40 |
lubos |
So not in default template, right? I should create template / widget for this... |
# |
Jun 28th 2018, 14:39 |
josbeir |
@kunalspunjabi back to debugging then ! |
# |
Jun 28th 2018, 14:39 |
josbeir |
@lubos you can change the templates option |
# |
Jun 28th 2018, 14:38 |
kunalspunjabi |
@josbeir fixed the issues with the javascript helper, now it's back to the same error! ugh ```Notice (8): Undefined variable: isProduction [APP/View/Elements/seo.ctp, line 16] ``` |
# |
Jun 28th 2018, 14:37 |
lubos |
So I imagine something like ``` 'type' => 'radio', 'options' => [ 0 => 'No', 1 => [ 'value' => 'Yes', 'class' => 'yes-input' 'data-what' => 'ever' ] ``` |
# |
Jun 28th 2018, 14:35 |
lubos |
https://book.cakephp.org/3.0/en/views/helpers/form.html#options-for-select-checkbox-and-radio-controls |
# |
Jun 28th 2018, 14:35 |
lubos |
FormHelper, is it possible to set html attributes for select options / radio options? |
# |
Jun 28th 2018, 14:32 |
josbeir |
have fun ! |
# |
Jun 28th 2018, 14:24 |
kunalspunjabi |
working on it @josbeir |
# |
Jun 28th 2018, 14:14 |
generitter |
Looks like the Core FormHelper class has been extended and the interfaces no longer match. |
# |
Jun 28th 2018, 14:14 |
josbeir |
there are quite some differences between cake 1 and 2 |
# |
Jun 28th 2018, 14:13 |
josbeir |
you should fix al those errors |
# |
Jun 28th 2018, 14:13 |
josbeir |
thats a good thing |
# |
Jun 28th 2018, 14:13 |
kunalspunjabi |
@josbeir removing the javascript helper actually throws more errors ```Strict (2048): Declaration of MyFormHelper::beforeRender() should be compatible with Helper::beforeRender($viewFile) [APP/View/Helper/my_form.php, line 12] ``` in addition to what I was seeing earlier. Not sure of a fix but Im investigating |
# |
Jun 28th 2018, 14:11 |
generitter |
I’m writing some test code to verify a route. I’m working in a plugin, the plugin has routes. Does anyone know how to load the routes in my config for the test? The Test results I’m extending Cake TestCase. |
# |
Jun 28th 2018, 14:02 |
itmpls |
thx for the insight |
# |
Jun 28th 2018, 14:02 |
josbeir |
doesn't seem that much work :slightly_smiling_face: you can do it! |
# |
Jun 28th 2018, 14:01 |
itmpls |
yup i have the subdomain records in the db. i need to whitelist them in the middleware first |
# |
Jun 28th 2018, 14:00 |
josbeir |
or store them in the db where you filter them by site/domain and inject them somewhere based on the current site |
# |
Jun 28th 2018, 13:59 |
josbeir |
and load them in the middleware too |
# |
Jun 28th 2018, 13:59 |
josbeir |
with my aproach i can store these routes in the site configuration object |
# |
Jun 28th 2018, 13:58 |
josbeir |
but tbh if its just a few extra routes per sub/domain |
# |
Jun 28th 2018, 13:58 |
itmpls |
yeah it doesn't seem like it would make sense for my approach :P |