# |
May 26th 2017, 22:00 |
adithya |
Hello, I'm a beginner and I wanted to know how to add oauth based login with google and fb! How do I go about doing this ? Thanks in advance :grinning: |
# |
May 26th 2017, 21:39 |
rudy1976s |
but I cannot figure out how embed the jquery needed to run it |
# |
May 26th 2017, 21:36 |
rudy1976s |
I am just looking at the core widget |
# |
May 26th 2017, 21:36 |
GMSteuart |
ah, gotcha. i wont be much help then at this point unfortunately. the convo i just had with jeremy though describes a good use case for me implement a custom widget though |
# |
May 26th 2017, 21:27 |
rudy1976s |
I have already implemented it as an element but would like to learn widgets too |
# |
May 26th 2017, 21:26 |
GMSteuart |
lol, well im about to, but let me do some quick research for you, a custom widget might not be necessary for bootstrap |
# |
May 26th 2017, 21:25 |
rudy1976s |
I need to learn how to integrate the BootstrapSwitch as a Form widget but I found the book a bit confusing me :anyone here ahave created custom form widget ? |
# |
May 26th 2017, 21:20 |
GMSteuart |
rudy, i believe there is a 'required' attribute attached to each form input that is required by the model |
# |
May 26th 2017, 21:20 |
jeremyharris |
np, good luck |
# |
May 26th 2017, 21:19 |
GMSteuart |
thanks jeremy |
# |
May 26th 2017, 21:14 |
rudy1976s |
Hello in a form is there a way to know the required field of the model attached to that form ? I need to create a way to bind jeury clienti validation to every form without having to modify every form |
# |
May 26th 2017, 21:11 |
jeremyharris |
so you can either do $this->Form->input(‘check’, [‘type’ => ‘checkbox’, ‘labelOptions’ => [‘for’ => ‘test’]]) everywhere, or use templateVars (an additional array) or overwrite FormHelper::label / control or the widget |
# |
May 26th 2017, 21:10 |
jeremyharris |
so like $this->Form->input(‘check’, [‘type’ => ‘checkbox’, ‘labelOptions’ => [‘templateVars’ => [‘for’ => ‘test’]]]) |
# |
May 26th 2017, 21:09 |
jeremyharris |
I think that template var needs to be passed to your label options still |
# |
May 26th 2017, 20:59 |
GMSteuart |
'nestingLabel' => '<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{for}}">{{input}}<span class="mdl-checkbox__label">{{text}}</span></label>' |
# |
May 26th 2017, 20:59 |
GMSteuart |
unless theres something i am missing when accessing properties inside the string template, my current template is the following: 'checkbox' => '<input class="mdl-checkbox__input" type="checkbox" name="{{name}}" id="{{name}}" {{attrs}}/>', |
# |
May 26th 2017, 20:58 |
GMSteuart |
thanks. thats probably what I will look into doing. the goal was to get MDLs checkboxes implemented. |
# |
May 26th 2017, 20:55 |
jeremyharris |
the widget could basically convert the existing `for` which is created by FormHelper::label |
# |
May 26th 2017, 20:55 |
jeremyharris |
if you want to *always* overwrite it, perhaps extending the LabelWidget or the FormHelper::control would be a better option |
# |
May 26th 2017, 20:54 |
GMSteuart |
$this->Form->control('is_archived', ['type' => 'checkbox']); |
# |
May 26th 2017, 20:54 |
GMSteuart |
i could just have: |
# |
May 26th 2017, 20:54 |
GMSteuart |
<?= $this->Form->control('is_archived', ['type' => 'checkbox', 'templateVars' => ['for' => 'is_archived']]); ?> |
# |
May 26th 2017, 20:54 |
GMSteuart |
so i can work around it by using the templateVars option, my goal was to be as lazy as possible. so instead of having: |
# |
May 26th 2017, 20:50 |
GMSteuart |
@jeremyharris testing |
# |
May 26th 2017, 20:47 |
jeremyharris |
GMSteuart have you tried passing your for into labelOptions when creating the input |
# |
May 26th 2017, 20:40 |
GMSteuart |
I am having trouble finding a solution to configuring the 'for' attribute in a html template of mine. I need to be able to set the attribute to the underscore version of the name rather than the hyphenated version. (e.g. instead of for="foo-bar" have for="foo_bar") |
# |
May 26th 2017, 20:32 |
jeremyharris |
np |
# |
May 26th 2017, 20:32 |
HenriqueMachado |
thanks |
# |
May 26th 2017, 20:32 |
HenriqueMachado |
i'll read abou link.. i unknow |
# |
May 26th 2017, 20:32 |
jeremyharris |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-belongstomany-associations |
# |
May 26th 2017, 20:31 |
jeremyharris |
I think you’ll be better off using link() though |
# |
May 26th 2017, 20:31 |
jeremyharris |
the second and third param of save() are wrong but that looks closer to what you want |
# |
May 26th 2017, 20:30 |
HenriqueMachado |
hehehe |
# |
May 26th 2017, 20:30 |
HenriqueMachado |
should be like this? https://pastebin.com/7MyDDKi2 |
# |
May 26th 2017, 20:30 |
jeremyharris |
I’d suggest going through the new ORM documentation to learn a bit about it, much has changed for the better. You jumped into something pretty complex right off the bat :) |
# |
May 26th 2017, 20:29 |
HenriqueMachado |
i see.. i think its working now.. i need to see how to save it now |
# |
May 26th 2017, 20:25 |
jeremyharris |
which should be an instance of your UsersTable because you told the association to use that |
# |
May 26th 2017, 20:25 |
jeremyharris |
k that’s fine. when you define the association, the first param is the “alias” so to speak, so you access it via $this->Users->Follower |
# |
May 26th 2017, 20:23 |
HenriqueMachado |
i have users table and users_followers table, but i dont have a followers table |
# |
May 26th 2017, 20:22 |
jeremyharris |
you have a UsersFollowers table? your associations don’t use that table class (though they indeed use the users_followers table itself) |
# |
May 26th 2017, 20:21 |
HenriqueMachado |
i've only UserTable and UsersFollowersTable |