-
Posts
1,065 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zeka
-
Hi @Klenkes I can't reproduce it with https://ckeditor.com/ckeditor-4/ and Firefox Quantum. Maybe it worth to raise an issue here https://github.com/ckeditor/ckeditor-dev
-
@taoguang It depends on your Page Refference field settings. If you have set 'Multiple pages', so to output author names foreach($page->authors as $author) { echo $author->title; } If 'Single page' echo $page->author->title;
-
Hi @taoguang Lest assume that you have this structure Books ( template: books ) - Book ( template: book ) - Book 1 ( template: book ) Authors ( template: authors ) - Author ( template: author) - Author 1 ( template: author) So to link author page to its books you have to create two page-reference fields: books and authors. The 'books' fields should use 'book' template as the selector and 'authors' field should use 'author' template as the selector. Then add 'books' field to 'author' template and 'authors' field to 'book' template'. Also, you can use this module https://modules.processwire.com/modules/connect-page-fields/ You can find why it would be helpful for your purpose by reading the description on its page.
-
Get current langauge in init.php or init method of module
Zeka replied to Zeka's topic in General Support
@Sergio Thanks, I have tried all from that thread, but it also doesn't work. $this->wire("user")->language->name always returns 'default', but in ready.php or ready modules method it works as expected, so it seems that user language is determined and set on ready stage here. The issue that I'm trying to solve: I'm using Padloper and by accessing 'padloper/ajaxViewCart/' I can get the view of the cart for ajax requests. It works as expected for default language, but not for non-default languages. So, I was trying to find a way how to get current language, but now I assume that it's not going to help as on init stage there is no page object and I actually can't get non-default lang values of fields. Here the code which responsible for that. public function init() { ..... $this->addHookBefore('ProcessPageView::execute', $this, 'runPadloper'); .... } public function runPadloper($event) { $it = isset($_GET['it']) ? $_GET['it'] : ""; if (substr($it, 0, 1) === '/') $it = ltrim($it, "/"); // We only allow urls like /padloper/ and /d/ here if(strpos($it, "padloper/") !== false || strpos($it, "d/") !== false) { // Do nothing } else { return; } switch ($it) { ..... case 'padloper/ajaxViewCart/': echo $this->modules->get("PadRender")->viewCart(); exit(); break; -
Get current langauge in init.php or init method of module
Zeka replied to Zeka's topic in General Support
@Sergio Thanks, but not in templates/_init.php, but site/init.php -
Hi! Just curious is it possible to get current language in init.php or init method of modules?
-
@bernhard Have you seen this https://www.ag-grid.com/javascript-grid-reference-overview/#listening-to-events?
-
@synapse To not log out you can test such things in the incognito mode
-
It is visible only for superuser, for the guest user you should get 404 error by visiting links of diactivated languages
-
@gebeer Take a look at Ryan comment at this issue https://github.com/processwire/processwire-issues/issues/538
- 7 replies
-
- 2
-
- custom user
- repeater
-
(and 4 more)
Tagged with:
-
Try to add namespaces to your module.
-
@MSP01 You can create endpoint (template and page) where you can catch get parameters like ?unsubscribe=140530045 or ?disable=140530045 then do something like if($input->get->unsubscribe || $input->get->disable) { $subscription = $pages->get($sanitizer->pageName($input->get->unsubscribe)); if($subscription->id && $input->get->unsubscribe) { $pages->trash($subscription); } elseif ($subscription->id && $input->get->disable) { ... logic for disabling user subscription } }
-
Actually, I think that is a great idea to track interest for modules, but it would be nice to have this feature and tracked information more centrally and open, so a potential user can see 'popularity' of modules that it gonna use.
-
Selector operator *= does not always find a match
Zeka replied to Marcel Stäheli's topic in General Support
From https://processwire.com/api/selectors/https://processwire.com/api/selectors/https://processwire.com/api/selectors/ -
[solved] Do the PW commercial modules all support multilang?
Zeka replied to neosin's topic in Multi-Language Support
Hi @neosin Repeater Matrix supports ML. -
Hi @DV-JF It's not possible to deactivate the default language in PW. You can create custom inputs (checkboxes) to enable/disable specific language for page and then in your template check whether this page is viewable for this language and if not throw 404. In that way, you will rely on custom inputs for languages, so default language checkboxes should be checked for languages. You can use this hook for that $wire->addHookAfter('Pages::added', function($event) { $page = $event->arguments(0); foreach ($this->wire->languages as $lang) $page->set("status$lang", 1); $page->save(); }); One drawback that I'm thinking about is that in your find() methods you have also check if this page viewable for this language. This is not tested but may work. Also, take a look at this module, you may find it useful in some cases
- 1 reply
-
- 2
-
@MilenKo There are two routes how you can achieve ML menus with MB. 1. Create separate menu for every language and depending on user language pass different pages for menu render method. 2. Enable additional language for the menu ( Settings tab -> Other active languages for this menu) I think that it is what you are looking for.
-
Hi @neosin Are there errors in PW and server logs? There is the similar thread
-
@clickpass You can use array_chunk, or use hook to add similar method to WireArray object. Take a look at this post
-
@yinken Does it work for you?
-
@theo I think that is something that should be reported. Could you open an issue on Github, so Ryan could comment is it intended behavior or a bug?