Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/02/2022 in all areas

  1. I have worked with a few multilanguage sites in ProcessWire and always found it so easy. We recently took on a WordPress site with multilanguage and wow, what a difference. I appreciate its all about the plugins that were chosen, but the plugin used is in the top 2 and it is so clunky. An entry for every language, so you have to upload the same images for every language just to change the text (I know there will be better ways to do this when you dig deep, but I am talking out of the box). Well done @ryan, when the next multilanguage site comes up I will always be confident in what we use.
    4 points
  2. You can learn from studying the Helloworld module: https://processwire.com/modules/helloworld/ From the readme:
    3 points
  3. We recently launched DOMiD Labs, a new microsite for our existing client DOMiD. We already built the main site for DOMiD in 2019, as shown in our previous post here and featured in ProcessWire Weekly #296. The new DOMiD Labs site belongs to a project to plan participative museum concepts for the upcoming migration museum in Cologne, Germany. Concept, design and implementation by schwarzdesign - web agency in Cologne, Germany. Featured in ProcessWire Weekly #433 We're using an in-house starter project to bootstrap new ProcessWire projects. This allows us to deliver smaller projects on a low budget while still providing an extensive, modular content system and to spend some time polishing the features our clients care about. Notable features of the site include: A modular content builder utilizing the excellent Repeater Matrix field. A blog area with a paginated news index page. Multi-language support (site available in English and German). Q&A sections using accordion elements. A contact form built with the Form Builder module. Fully configurable navigation and footer components. Custom translation management for interface translations. Learn more: domidlabs.de
    2 points
  4. Using my vscode snippets extension all you need to do is adding your settings to the getModuleConfigInputfields method: $inputfields->add([ 'type' => 'text', 'label' => 'Foo Setting', 'name' => 'foo', 'value' => $this->foo, ]); return $inputfields; https://marketplace.visualstudio.com/items?itemName=baumrock.pwsnippets
    2 points
  5. Hi @ryan Slovenian "Language: sl\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);\n" msgid "%d translated message" msgid_plural "%d translated messages" msgstr[0] "%d prevedenih sporočil" msgstr[1] "%d prevedeno sporočilo" msgstr[2] "%d prevedeni sporočili" msgstr[3] "%d prevedena sporočila" Russian "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "%d day ago" msgid_plural "%d days ago" msgstr[0] "%d день назад" msgstr[1] "%d дня назад" msgstr[2] "%d дней назад" Czech (some as Russian) msgid "Updated %d path" msgid_plural "Updated %d paths" msgstr[0] "Aktualizována %d cesta" msgstr[1] "Aktualizovány %d cesty" msgstr[2] "Aktualizováno %d cest" Almost all Slavic languages have such plural forms. If you get support for these multiple forms, it will greatly improve the translation. Gettext algorithms for all languages can be found here: http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
    2 points
  6. I found a solution: instead of Wireframe::partial call $this->view->partials->get.
    2 points
  7. The easiest and best way to setup this stack in my opinion is ddev. DDEV is an open source tool that makes it dead simple to get local PHP development environments up and running within minutes. It's powerful and flexible as a result of its per-project environment configurations, which can be extended, version controlled, and shared. In short, DDEV aims to allow development teams to use Docker in their workflow without the complexities of bespoke configuration. Me and @bernhard use it, and are very satisfied. I am using it on Windows 11 inside of WSL2. But it also runs on Macs and Linux machines.
    1 point
  8. I am a noob at this framework. While looking for dynamic options I found many modules have options/settings in the module. While I wanted to develop a module I found that I lack the knowledge of adding options in a module setting page. How to add options (radio buttons,selectors) in my processwire module?
    1 point
  9. This week we have ProcessWire 3.0.201 on the dev branch which includes a couple minor fixes but also a couple of useful additions: There are new "Tab" field visibility options available for any field in the page editor. This makes the field display in its own page editor tab. It saves you from having to create a new/separate Tab field just to wrap around an existing field to make it display in a tab. So far I've found it particularly useful with ProFields (Combo, Table, Textareas, RepeaterMatrix) as well as the core Repeater, FieldsetPage and Images fields. For instance, I have a Combo field labeled "SEO" that lets me edit browser_title, meta_description, canonical_url, etc., and now I can add that field to any template and pages using that template have their own "SEO" tab. Sure you could do this before by creating a separate tab field with an "SEO" label, but now it's a lot simpler/faster, as any field can now display as a tab on its own. Like with the other visibility modes, also included are options to make the tab load dynamically on click with ajax or make the value non-editable. You can also optionally specify a label for the tab independently of the field label. This is because usually you want tab labels to be very short (1 word is best) whereas field labels have no such need. Please note that this new Tab option is exclusive to the page editor, and in order to work the field must not already be in a tab. Also added this week is a new $page->getMultiple() method. This method works the same as the $page->get() method except that it lets you retrieve multiple page property/field values at once and returns them in an array. For example: $a = $page->getMultiple([ 'foo', 'bar', 'baz' ]); list($foo, $bar, $baz) = $a; It also accepts a CSV string: $a = $page->getMultiple('foo,bar,baz'); By default it returns a regular PHP array, suitable for using in list() like the first example. But if you want it to return an associative array instead, then specify true as the 2nd argument: $a = $page->getMultiple('foo,bar,baz', true); echo $a['foo']; echo $a['bar']; echo $a['baz']; I find this method useful in reducing the amount of code/lines necessary in many cases, and most often I use it in combination with a PHP list() call, i.e. list($title,$subtitle,$body) = $page->getMultiple('title,subtitle,body'); That's all for this week. Thanks for reading and have a great weekend!
    1 point
  10. Just released the new version of the german language pack for stable version 3.0.200
    1 point
  11. The truth lies in the middle of both code snippets ? If using Pages::saved you need to use setAndSave because if you only change the page property there will be no later save that actually saves it. If using Pages::saveReady as 3fingers showed you can use setAndSave but it's actually not necessary. You can simply use $page->yourfield = 'foo'; as the page IS actually saved right afterwards. Also I prefer to use early exists rather than a lot of if ... if ... if ... but that's a matter of preferance ? <?php $wire->addHookBefore('Pages::saveReady', function($event){ $page = $event->arguments(0); if(!$page->hasField("my_checkbox")) return; if($page->my_checkbox) return; $page->another_integer_field = 0; $this->message("This should have worked"); //for debugging only });
    1 point
  12. Another possible way to approach it is to find both normal and repeater pages and then convert the repeater pages into the non-repeater pages that contain them. FieldsetPage is a kind of Repeater. // Function to get the root container page when the supplied page might be a RepeaterPage function getRootContainer($page) { if($page instanceof RepeaterPage) { return getRootContainer($page->getForPage()); } else { return $page; } } // Get your Page Reference field $f = $fields->get('page_selector'); // Get the templates that contain the field (including Repeater templates) $tpls = $f->getTemplates(); // Implode to a string for use in a selector $tpls_string = $tpls->implode('|', 'name'); // Find pages (including Repeater pages) where the field is populated // The check_access=0 is so that Repeater pages are found when $user is a non-superuser $items = $pages->find("template=$tpls_string, check_access=0, $f.count>0"); // An empty PageArray that will hold the results $results = new PageArray(); foreach($items as $item) { // Convert any Repeater pages to their root container page and add to the results $results->add(getRootContainer($item)); } // Now use $results as needed
    1 point
  13. Hi. Not tested but should work $this->wire()->addHookAfter('LanguagesPageFieldValue::getStringValue', function ($event) { $value = $event->return; $languagesPageFieldValue = $event->object; $languages = $this->wire()->languages; $userLanguageID = $this->wire()->user->language->id; $chineseLanguageID = $languages->get('chinese')->id; $newFallbackLanguageID = $languages->get('english')->id; if($userLanguageID === $chineseLanguageID && !$languagesPageFieldValue->getLanguageValue($chineseLanguageID)) { $value = $languagesPageFieldValue->getLanguageValue($newFallbackLanguageID); if(!strlen($value)) { $value = $languagesPageFieldValue->getDefaultValue(); } }; $event->return = $value; });
    1 point
  14. Dear All, I've created a 'member' user role, and would like to block users with that role from seeing the Admin backend. Instead, if they do go to the admin login, and then log in, I'd like to redirect them to to a specialized log in page for members, where I'll do some redirections based on their account details. I also want to modify the standard login screen, and place some explanatory text on it, but I searched for the word "Login" for example, and couldn't find which file to edit. I must be missing something. I've copied the 'templates-admin' directory to my site directory, and have examined the default.php file. But when I put some code into the file to test for the superuser (just as a test, since I actually want to test for the 'member' role), I ended up blocking the login page. So, even the superuser couldn't log in. I believe I placed that code in the wrong place. Does anyone have any tips? I want to block all access to the admin pages, but I still want to allow a member user to add and edit data using custom forms. Thanks! Peter
    1 point
  15. Does anyone have issues when sometimes PW does not load page tree? I have came across with all PW versions I have used. I can't open "Sākums". I try to refresh. There is no dropdowns from Setup/Modules/Access. EDIT: this didn't help : "To fix it i have to logout - but only from mobile version since User menu does not popout" Sadly I can't replicate it.
    1 point
  16. @ryan, could you please add an option to include setlocale() in the exported config.php if it is defined. Now that PW is giving warnings if setlocale() is missing it would be nice not to have to remember to manually add this each time a profile is installed.
    1 point
  17. Sure--though I am aware of most of them, but it would be good for me to know which ones are most important to people so that I can put those first. The two you mentioned are actually fields, so they are in the DB rather than a file. You can edit them by editing the 'roles' or 'email' fields. These don't appear in your fields list until you click Filters > Show System Fields. Currently we only support singular and plural, and not multiple kinds of plurals. I will have to add support for this the next time we are doing upgrades to the Language Support modules. Though so far it's not clear to me how the function implementation work for this. I'm looking for gettext examples that demonstrate it.
    1 point
×
×
  • Create New...