
kuba
Members-
Posts
19 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
kuba's Achievements

Jr. Member (3/6)
6
Reputation
-
Has anyone had the opportunity to enhance the TextformatterFindReplace module to support multilingual fields?
-
This solution works!
-
Here is an API solution to disable page language, shared by Rayan, for anyone interested. $wire->addHookBefore('InputfieldPageName::render', function(HookEvent $e) { $inputfield = $e->object; foreach($e->wire()->languages as $language) { $name = "status$language"; if($inputfield->checkboxName != $name) continue; if($inputfield->checkboxChecked) { // Checkbox for $language->name is checked } else { // Checkbox for $language->name is not checked } // to change set $inputfield->checkboxChecked = true or false } }, [ 'priority' => 200 ]);
-
If you're having trouble managing the "Active URL" status through the CMS interface, I found that a direct database update may be the solution. Here’s a working SQL command to set status2818 = 0 for all selected language/pages(both published and unpublished): UPDATE pages SET status2818 = 0 WHERE published IS NULL OR published IS NOT NULL;
-
Thank you again for the reply. I did find this thread, but the solution doesn't work, at least with PW 3.0.246. foreach ($languages->findNonDefault() as $language) { $page->setLanguageStatus($language, true); } $language returns the right ID, e.g. 2818. setLanguageStatus does not affect anything, regardless of whether it is set to true or false. The issue with setAndSave is that it cannot handle applying changes to all pages, hanging the whole platform. The RockMigrations module uses also setAndSave. public function activate(HookEvent $event) { $page = $event->arguments(0); $languages = $this->wire->languages->findNonDefault(); foreach ($languages as $lang) $page->setAndSave("status$lang", 1); }
-
Is there a gentler way to disable one language across all pages; the "Active" URL? foreach ($page as $p) { $p->of(false); $p->setAndSave('status2818', false); }
-
Thank you for the hint, I guess this option "Perform a 302 (temporary) redirect to the page in default language" may work.
-
Hi everyone, I run an English website, and I’m adding translations with ProcessWire. Right now, enabling a new language creates URLs for every page (and leads to 404 errors if the translation URL isn’t "Active"). Here’s what I’d like instead: Translate in stages: Start with just a few pages (e.g. Page 1, Page 2, Page 3). Language-specific nav: On translated pages, show links only to other active translations. Fallback to English: If a visitor requests an untranslated page (like /de/contact or /de/blog), display the default URL (like /contact, /blog). My site has dozens of pages, so a full translation will take months. I’d rather roll out a small batch each day to test and refine the process. Does anyone know if ProcessWire can be configured this way? Any tips or examples would be much appreciated! Thanks!
-
@ryan OK, I will let you know. This update fixes probably all the issues.
-
@Sandy Did you manage to discover what was the issue that hooks don't work inside /site/ready.php?
-
@ryan Should the AutoLinks module not save all settings for ConfigurableModule interface? After saving it adds all links to articles, but the textarea with all provided terms is set to empty. After saving again all links are removed.
-
Thank you for the update. I did exactly that. The file permission of the .js file was the issue. There was no execution allowed. Now it works ? To calculate reading time I use this code on my website. 250 words per minute is the recommended value for English language. function calculateReadTime($text) { // Average reading speed in words per minute $averageReadingSpeed = 200; // Strip HTML tags and count the words $wordCount = str_word_count(strip_tags($text)); // Calculate the read time in minutes $readTime = ceil($wordCount / $averageReadingSpeed); return $readTime; }
-
I followed the steps exactly. The plugin appears in the External Plugins section, but when I enable it, it's not accessible. It should add a button and show up in the Tools drop-down menu.
-
I created a script for TinyMCE that calculates the readability of a given text using the Flesch Reading Ease formula based on a 0-100 scale. A high score means the text is easier to read for users (recommended score 60+). Low scores suggest the text is complicated to understand with too long paragraphs. It works with standard TinyMCE, however the question is how to make it run with ProcessWire? tinymce.init({ selector: 'textarea#template', plugins: 'readability', toolbar: 'readability', menubar: 'tools', menu: { tools: { title: 'Tools', items: 'readabilityTool' } } }); tinymce.PluginManager.add('readability', (editor, url) => { editor.ui.registry.addButton('readability', { text: 'Readability', icon: 'book', onAction: function() { const content = editor.getContent({format: 'text'}); const readabilityScore = calculateReadability(content); alert('Readability Score: ' + readabilityScore); } }); editor.ui.registry.addMenuItem('readability', { text: 'Readability', icon: 'book', onAction: function() { const content = editor.getContent({format: 'text'}); const readabilityScore = calculateReadability(content); alert('Readability Score: ' + readabilityScore); } }); editor.ui.registry.addMenuItem('readabilityTool', { text: 'Readability', context: 'tools', icon: 'book', onAction: function() { const content = editor.getContent({format: 'text'}); const readabilityScore = calculateReadability(content); alert('Readability Score: ' + readabilityScore); } }); return { getMetadata: () => ({ name: 'Readability' }) }; }); function calculateReadability(text) { var sentences = text.split(/[\.\!\?]/).filter(Boolean); var numSentences = sentences.length; var words = text.split(/\s+/).filter(Boolean).length; var syllables = 0; var wordArray = text.split(/\s+/).filter(Boolean); wordArray.forEach(function(word) { syllables += countSyllables(word); }); if (words > 0 && numSentences > 0) { var wordsPerSentence = words / numSentences; var syllablesPerWord = syllables / words; var readability = 206.835 - (1.015 * wordsPerSentence) - (84.6 * syllablesPerWord); return readability.toFixed(2); } else { return 0; } } function countSyllables(word) { word = word.toLowerCase(); var vowels = 'aeiouy'; var numVowels = 0; var prevCharWasVowel = false; if (word.length > 2 && word.substr(-2) == 'es') { word = word.slice(0, -2); } else if (word.length > 1 && word.substr(-1) == 'e') { word = word.slice(0, -1); } for (var i = 0; i < word.length; i++) { if (vowels.indexOf(word[i]) !== -1) { if (!prevCharWasVowel) { numVowels++; } prevCharWasVowel = true; } else { prevCharWasVowel = false; } } return numVowels > 0 ? numVowels : 1; }
-
@ryan Hey, when can we expect the release of those modules TextBlocks and AutoLinks?