# |
Jul 15th 2019, 18:42 |
daniel.upshaw |
By default it's supposed to use `nestingLabel` |
# |
Jul 15th 2019, 18:41 |
daniel.upshaw |
I wonder if that controls what uses nestingLabel |
# |
Jul 15th 2019, 18:40 |
ricksaccous |
yes |
# |
Jul 15th 2019, 18:40 |
daniel.upshaw |
That's in `Cake\View\FormHelper` |
# |
Jul 15th 2019, 18:40 |
slackebot |
['Textarea'], 'datetime' => ['DateTime', 'select'], '_default' => ['Basic'], ];``` |
# |
Jul 15th 2019, 18:40 |
daniel.upshaw |
``` /** * Default widgets * * @var array */ protected $_defaultWidgets = [ 'button' => ['Button'], 'checkbox' => ['Checkbox'], 'file' => ['File'], 'label' => ['Label'], 'nestingLabel' => ['NestingLabel'], 'multicheckbox' => ['MultiCheckbox', 'nestingLabel'], 'radio' => ['Radio', 'nestingLabel'], 'select' => ['SelectBox'], 'textarea' => |
# |
Jul 15th 2019, 18:40 |
ricksaccous |
and for regular checkboxes not using my widget it uses nestingLabel |
# |
Jul 15th 2019, 18:40 |
ricksaccous |
there's magic in formhelper that decides which label widget/template it uses |
# |
Jul 15th 2019, 18:40 |
daniel.upshaw |
Hrm |
# |
Jul 15th 2019, 18:39 |
daniel.upshaw |
Oh |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
and i don't know how to specify that |
# |
Jul 15th 2019, 18:39 |
daniel.upshaw |
Why not keep everything "toggleWidget" |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
but i want the control to use nestingLabel |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
it uses 'label' |
# |
Jul 15th 2019, 18:39 |
daniel.upshaw |
Hmmm |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
except the stupid label |
# |
Jul 15th 2019, 18:39 |
daniel.upshaw |
``` $templates->add( [ 'inputContainer' => $templates->get('toggleWidget'), 'checkbox' => $templates->get('toggleWidgetCheckbox'), 'nestingLabel' => $templates->get('nestingLabelToggleWidget') ] );``` |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
and they are being used |
# |
Jul 15th 2019, 18:39 |
ricksaccous |
yes, with the templates predefined |
# |
Jul 15th 2019, 18:38 |
daniel.upshaw |
Nice |
# |
Jul 15th 2019, 18:38 |
daniel.upshaw |
Oooh I see you're making a custom type |
# |
Jul 15th 2019, 18:38 |
ricksaccous |
and i can't put a hidden field there |
# |
Jul 15th 2019, 18:38 |
ricksaccous |
it's using the actual "label" widget/template |
# |
Jul 15th 2019, 18:38 |
ricksaccous |
no, the problem is my widget is not using the correct template/widget for label |
# |
Jul 15th 2019, 18:37 |
daniel.upshaw |
But when you specify it in each control, it works? |
# |
Jul 15th 2019, 18:37 |
daniel.upshaw |
Is the problem that it changes everywhere? |
# |
Jul 15th 2019, 18:37 |
daniel.upshaw |
So when you change it |
# |
Jul 15th 2019, 18:36 |
ricksaccous |
you can't stick hidden inputs in there though |
# |
Jul 15th 2019, 18:36 |
daniel.upshaw |
``` // Input group wrapper for checkboxes created via control(). 'checkboxFormGroup' => '{{label}}',``` |
# |
Jul 15th 2019, 18:36 |
daniel.upshaw |
Do you have that in there? |
# |
Jul 15th 2019, 18:36 |
daniel.upshaw |
``` // Wrapper container for checkboxes. 'checkboxWrapper' => '<div class="checkbox">{{label}}</div>',``` |
# |
Jul 15th 2019, 18:35 |
ricksaccous |
give it a try yourself on your cake installation and see |
# |
Jul 15th 2019, 18:35 |
ricksaccous |
yeah, but it does use it for checkboxes |
# |
Jul 15th 2019, 18:34 |
daniel.upshaw |
Doesn't seem to mention checkbox there |
# |
Jul 15th 2019, 18:34 |
daniel.upshaw |
``` // Label element used for radio and multi-checkbox inputs. 'nestingLabel' => '<label{{attrs}}>{{hidden}}{{input}}{{text}}</label>',``` |
# |
Jul 15th 2019, 18:34 |
ricksaccous |
it's the easiest way for now |
# |
Jul 15th 2019, 18:34 |
daniel.upshaw |
Hmm |
# |
Jul 15th 2019, 18:33 |
ricksaccous |
lol |
# |
Jul 15th 2019, 18:33 |
ricksaccous |
screw it i'm just going to make it an element |
# |
Jul 15th 2019, 18:33 |
ricksaccous |
ugh |
# |
Jul 15th 2019, 18:32 |
ricksaccous |
template/widget |