# |
Nov 12th 2019, 12:08 |
tobse |
For a simple language switcher you just need to edit the content of your static pages. Use the language functions and define the locale like described here. https://book.cakephp.org/3/en/core-libraries/internationalization-and-localization.html#changing-the-locale-at-runtime If you have larger content-blocks you can use switch-case for each language-version in your ctp-file |
# |
Nov 12th 2019, 12:01 |
pieceof |
edit config/routes.php |
# |
Nov 12th 2019, 11:59 |
pieceof |
web ui -> localization L10n, content -> internazionalization i18n |
# |
Nov 12th 2019, 11:55 |
massimoi |
Hi, can anybody help me with this simple problem. I'm used to CakePHP 2.x and I'm new to CakePHP3. I need a simple thing: I need elements and static pages to be in different languages. In 2.x I edited the path of the page in the PagesController, but new I don't understand how to do it. Can you help? Thanks |
# |
Nov 12th 2019, 11:32 |
development |
Played with it a bit. It's unfortunate that I develop on Windows (no symlinks), but what I wanted to achieve works. Thanks for the quick reply! |
# |
Nov 12th 2019, 11:31 |
slackebot1 |
$validator->isArray('semestershelves') ->requirePresence('semestershelves') ->notEmptyArray('semestershelves', __('Please choose at least one entry.'); ``` Or do I have to run the validation manually before building the entity in the controller? Or put the validation into the associated model? Thanks for any advice. |
# |
Nov 12th 2019, 11:31 |
tobse |
Hi to all, one question about validation of associated models. I'm having a "belongsToMany"-association between "contents" and "semestershelves". "content" belongs to one or many "semestershelves". In my form I have multiple checkboxes of entries of the associated model. What I like to obtain is a validation-error when no checkbox is checked. I tried the following in the default validator of the contents-table: ``` |
# |
Nov 12th 2019, 11:12 |
hmic |
val: remove/disable the behavior |
# |
Nov 12th 2019, 11:02 |
val |
Hi, what is the proper way to remove unnecessary join to i18n table in models that use TranslateBehavior in 3.x when the translation field is not supposed to be retrieved? |
# |
Nov 12th 2019, 10:37 |
jotpe |
Both approaches not working |
# |
Nov 12th 2019, 10:37 |
slackebot1 |
<jotpe> |
# |
Nov 12th 2019, 10:36 |
jotpe |
I tried this: |
# |
Nov 12th 2019, 10:36 |
jotpe |
Anyone knows how to pass cli params to a engine in CakePDF? https://github.com/FriendsOfCake/CakePdf#configuration |
# |
Nov 12th 2019, 10:27 |
development |
Didn't know about the symlink option. I will try that, thanks! |
# |
Nov 12th 2019, 10:26 |
challgren |
Have you tried https://book.cakephp.org/3/en/console-and-shells/plugin-shell.html#plugin-assets |
# |
Nov 12th 2019, 10:25 |
development |
Morning all, could anyone tell me how I can trigger all css/js files within a certain plugin folder with .htaccess? When I use "<FilesMatch "\.(css|js)">" it only triggers files that are in /webroot and not files that are in /plugins/MyPlugin/webroot. I would like to set the cache headers for cetrain js/css files which reside inside a plugin folder. |
# |
Nov 12th 2019, 09:11 |
challgren |
@mehov for example LastPass will autofill forms even hidden fields |
# |
Nov 12th 2019, 09:10 |
challgren |
evening |
# |
Nov 12th 2019, 07:57 |
javier.villanueva |
morning |
# |
Nov 12th 2019, 07:57 |
admad |
moin |
# |
Nov 12th 2019, 07:57 |
jotpe |
Morning |
# |
Nov 12th 2019, 07:56 |
admad |
3.x csrftoken is per session, so it's always going to remain same either way |
# |
Nov 12th 2019, 07:54 |
admad |
@mehov apparently it was required because of some safari shenanigans https://github.com/cakephp/cakephp/commit/27994ab1d8d66d61581ae13f5c5fceb61d36d933 |
# |
Nov 12th 2019, 07:52 |
mehov |
okay, got it thanks for explaining! :) |
# |
Nov 12th 2019, 07:51 |
admad |
maybe someone wanted to be overcareful for no reason :slightly_smiling_face: |
# |
Nov 12th 2019, 07:51 |
mehov |
okay then why do all these hashes and tokens have autocomplete="off" even though they're hidden? (not being a dick, just learning) |
# |
Nov 12th 2019, 07:51 |
admad |
in 4.x you won't even have the `_method` named input for post forms |
# |
Nov 12th 2019, 07:50 |
admad |
there's no need, the input already has a value and is hidden, it's not going to be autocompleted |
# |
Nov 12th 2019, 07:48 |
mehov |
I looked at the end of the form and "_Token[unlocked]" has explicit autocomplete="off" as well, even though it's value doesn't seem to be a hash Should I contribute autocomplete="off" to the _method as well to keep it consistent? |
# |
Nov 12th 2019, 07:45 |
admad |
it wont |
# |
Nov 12th 2019, 07:44 |
mehov |
Hi everyone, When I use FormHelper, it adds these hidden inputs: "_method" and "_csrfToken". The token has autocomplete="off" for obvious reasons, but the method doesn't. Can I be sure it won't interfere with browser remembering the login form data if I use FormHelper there? Source code for the _method here: https://github.com/cakephp/cakephp/blob/9e14905eba24497a26e8ab5bdf192941086385c8/src/View/Helper/FormHelper.php#L479 |
# |
Nov 12th 2019, 05:08 |
admad |
@spriz you won't have this problem in 4.0 https://github.com/cakephp/cakephp/blob/4.x/src/I18n/functions.php#L29 |
# |
Nov 11th 2019, 23:25 |
cake101 |
anyone here? |
# |
Nov 11th 2019, 23:13 |
cake101 |
I am trying to add to an input with the type of select a class or id and both will not work. I have tried both Form->input and Form->select. cakephp v 2.10. please someone assist |
# |
Nov 11th 2019, 22:44 |
dereuromark |
@spriz As long as we dont have a clean __() to always return string, I just https://github.com/spryker/cakephp-statemachine/blob/master/tests/phpstan.neon#L9 |
# |
Nov 11th 2019, 21:29 |
spriz |
Also do I miss something or do I need to do this? ``` |
# |
Nov 11th 2019, 21:26 |
spriz |
@admad how about `Parameter #1 $message of method Cake\Controller\Component\FlashComponent::success() expects string, string|null given.` when doing `$this->Flash->succes(__('Great success!'));` ? |
# |
Nov 11th 2019, 21:24 |
spriz |
Much love @admad! |
# |
Nov 11th 2019, 19:39 |
admad |
@spriz https://github.com/FriendsOfCake/crud/blob/master/phpstan.neon#L4 |
# |
Nov 11th 2019, 19:11 |
spriz |
and avoid `Access to an undefined property object::$query.` |
# |
Nov 11th 2019, 19:10 |
spriz |
How do you make phpstan happy about this one?! :) $this->Crud->on('beforePaginate', function (Event $event) { $event->getSubject()->query->find('NonDraft'); }); |