# |
Apr 18th 2019, 14:42 |
neon1024 |
`$this->_viewBuilder->setHelpers();` ? |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
and you would use a different method to do that |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
but yes, it's probably better to add them in the AppView class |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
you can add helpers that way |
# |
Apr 18th 2019, 14:41 |
this.impetus |
TBH, I *always* try. But I learned PHP years ago, and cake before it implemented namespace stuff, and I often find that I don't quite understand the API. |
# |
Apr 18th 2019, 14:41 |
neon1024 |
That’s not where you add helpers. |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
lol |
# |
Apr 18th 2019, 14:41 |
ricksaccous |
he's using viewBuilder in controller |
# |
Apr 18th 2019, 14:40 |
neon1024 |
So the method does exist. Which means you must have a typo I’d imagine |
# |
Apr 18th 2019, 14:40 |
ricksaccous |
in your case setHelpers is more appropriate |
# |
Apr 18th 2019, 14:40 |
ricksaccous |
learn to use that more often and you'll have less questions in general |
# |
Apr 18th 2019, 14:40 |
neon1024 |
AppView::loadHelper has been in for 4 years |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
;) |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
@this.impetus https://api.cakephp.org/3.7/class-Cake.View.ViewBuilder.html |
# |
Apr 18th 2019, 14:39 |
this.impetus |
```$this->viewBuilder()->getHelpers(['Thumber.Thumb']);``` seems to have pleased cake |
# |
Apr 18th 2019, 14:39 |
ricksaccous |
actually it's best to check the API |
# |
Apr 18th 2019, 14:38 |
this.impetus |
yeah, haha. thanks. don't be surprised if I come back |
# |
Apr 18th 2019, 14:38 |
this.impetus |
anyway, I should at least try to solve this myself |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
you can go through the docs to figure it out |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
then figure out what the better method to use is |
# |
Apr 18th 2019, 14:38 |
this.impetus |
but I keep getting errors stating that `loadHelper` isn't a method |
# |
Apr 18th 2019, 14:38 |
ricksaccous |
hehe |
# |
Apr 18th 2019, 14:37 |
this.impetus |
oh? As in now that we know it's there and installed, use the current cake API to actually load it? yeah `->helpers` is deprecated |
# |
Apr 18th 2019, 14:37 |
ricksaccous |
is helpers deprecated? |
# |
Apr 18th 2019, 14:37 |
this.impetus |
nah I can prolly google that |
# |
Apr 18th 2019, 14:37 |
ricksaccous |
don't use the deprecated method would be my advice |
# |
Apr 18th 2019, 14:37 |
this.impetus |
And this works. Final question—how do I suppress the deprecation errors? |
# |
Apr 18th 2019, 14:36 |
this.impetus |
Ahhhhh |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
the second part is the actual name of the helper |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
the first part of the string is the plugin namespace |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
Thumber.Thumb |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
it would be |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
so |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
I don't think you include the Helper part |
# |
Apr 18th 2019, 14:36 |
ricksaccous |
hehehehe |
# |
Apr 18th 2019, 14:36 |
this.impetus |
Thumb.Helper or something? |
# |
Apr 18th 2019, 14:35 |
ricksaccous |
this is a common theme throughout CakePHP |
# |
Apr 18th 2019, 14:35 |
ricksaccous |
when you load a helper from a plugin |
# |
Apr 18th 2019, 14:35 |
ricksaccous |
you need to prefix the plugin name |
# |
Apr 18th 2019, 14:35 |
this.impetus |
Or rather "Missing Helper" exception thrown |
# |
Apr 18th 2019, 14:35 |
this.impetus |
Hunh. Deprecation errors notwithstanding, that line with any of "Thumb", "Thumber", "ThumbHelper", "ThumberHelper" all say the helper is not found. |