Leaderboard
Popular Content
Showing content with the highest reputation on 03/12/2018 in all areas
-
You can add custom classes to the body of the ckeditor iframe. In the field settings (Input Tab) insert this in the "Custom Config Options" field: bodyClass: Inputfield_textarea1 If you need more flexibility you can also hook create a hook in your /sites/init.php to add multiple classes to all of your ckeditor fields: wire()->addHookBefore('Field(inputfieldClass=InputfieldCKEditor)::getInputfield', function(HookEvent $event) { // do not show modified data on Field edit page if ($this->wire('process') != 'ProcessPageEdit') return; $field = $event->object; $page = $this->pages->get($this->input->get->id); $customOptions = $field->customOptions; $customOptions .= "\nbodyClass: template-{$page->template} page-{$page->id} field-{$field->name}"; $field->customOptions = $customOptions; });4 points
-
The module has been lying around on GitHub for some time now, so I thought I'd give it its own forum topic so I can give it a module list entry. SymmetricEncryptedText Symmetric encryption for text based fields (supports multi language fields). Module page. Link to the GitHub repo. Description This module adds an encryption option to all text fields (and those derived from FieldtypeText). Field contents are encrypted using a symmetric key when a page is saved and decrypted when loaded from the database. The module by default uses sodium (if loaded) in PHP versions >= 7.2, otherwise it falls back to the bundled phpseclib. Multi-Language fields are supported too. WARNING! Setting a field to encrypted and saving values in those fields is a one-way road! Once encrypted, the contents cannot be unencrypted without writing a program to do so. Disabling the encryption option on a field after the fact gets you encrypted "garbage". Usage Download the zipped module through the green button at the top right of the GitHub repo or (once available there) from the official PW module repository Extract in its own directory under site/modules. In the backend, click "Modules" -> "Refresh", then install "Symmetric Encryption for Text Fields". Go to module settings. An appropriately sized, random key will be generated if this is your first use. Copy the supplied entry into site/config.php Add fields or configure already present fields. On the "Details" tab you can enable encryption for the field in question Edit a page with such a field, enter a value there, save and enjoy Existing, unencrypted values are left untouched until a new value is saved. That way, you can do a smooth upgrade to encryption, but you have to save all pre-populated pages to have their values encrypted in the database. Thus it is recommended to avoid adding encryption to already populated fields. Advanced Usage You can hook after SymmetricEncryptedText::loadKey to retrieve your key from somewhere else, e.g. a different server.3 points
-
This will take care of changing the published date: $query = $database->prepare("UPDATE pages SET published=:pub_date WHERE id=:page_id"); $query->execute([ ':pub_date' => $pubDate, ':page_id' => $pageId ]);3 points
-
After building the ProcessMentions module and another autocomplete module for images, I found that I am going to need even more of these, but things were going to get repetitive. So I refactored the whole thing into a basic autocompletion module and individual "actions". The result is Autocomplete for CKEditor (GitHub). To try out, Install the module and actions Enable actions in the settings of any CKEditor field Edit a page with this field, type "@" and some characters for the and enjoy There are still a few things I need to implement. ATM, it only supports single characters as triggers for the autocomplete. I'd like to change that to combinations so I don't run out of special characters at some point. I also have to add a few more configuration options (like search only at the beginning or also in the middle of the searched string). The documentation for custom styling also needs some work. I have tried to keep things generic. Implementing your own actions should be quite straight forward. The README at GitHub illustrates the main steps and the supplied action classes have inline documentation. I would love to get some feedback or even see some third party InlineCompleteAction implementations.2 points
-
Hey @Robin S - no worries - I hear things are a bit backwards in your part of the world BTW, I am a displaced Aussie - hope we can still be friends Thanks for pointing me in the right direction. The issue is that regex is greedy. You can see the problem here: https://regex101.com/r/ynCWrf/1 Here is a non-greedy that works fine: https://regex101.com/r/1Qta6X/1 Thanks again for a great module.2 points
-
In the admin we have an option to set a sorting for children using one field only. I have a problem with children getting sorted randomly when using a date field that is the same for multiple children. Usually we would sort by date and by ID or title, but we are only allowed to specify one field at a time. The problem with this is that once you edit one of those children, the sorting is randomly changed (actually everytime you edit a children) That's not really nice and very confusing. I had to use a dirty hook to change the children sorting one parent manually. $this->addHookBefore("ProcessPageList::find", $this, "sortingChildren"); public function sortingChildren(HookEvent $event){ $sel = $event->arguments("selectorString"); $page = $event->arguments("page"); if($page->template == "news-category"){ $event->setArgument("selectorString", $sel . ",sort=-datetime, sort=-id"); } } Maybe there's already a way I don't know or a module? But then I think this should be in core of course and not a module. Thanks.2 points
-
2 points
-
I can see you are concerned about ProcessWire project, as you speak so passionate @Donald. But I can't really get the point of all those posts. Let me guess: ProcessWire could have some better docs... Partly true, but it's getting better and the code is documented very well. Take a look. I also love Vue docs, but they are also not so helpful when you go from basic stuff to real projects. And as I see it PW is more complicated and has way more stuff to document. And new features are coming more often. ProcessWire will never beat Vue on github stars... I think so too, but not really due to lack of documentation. You think that this topic will not help PW get too much stars... Partly true, but anything is better than nothing. You want to get paid modules for free... I also sometimes think that donation based support could be better for the PW development. But it is not our decision and might not work as well here. You suggest to buy stars for ProcessWire github repo... Ryan will not do it for sure. Neither will I. If you got some money to spend it is up to you to try it, but I don't not feel like it is up with the ProcessWire spirit, if you will. Anyway, wanted to share my experience here on the forums. Being gentle always paid out better for me than being provocative)) P.S. The reply is to some posts that were probably removed by either the author or moderators. I did not actually see anything bad about them. But maybe some trolling was reasonably stopped by some good censors)2 points
-
Hi everyone, I know we'd all like to see ProcessWire grow in popularity (maybe not hugely, but just enough that more people know about it which can help to convince clients to go with it). It strikes me as strange that the ProcessWire Github repo still has less than 300 stars - I'd like to see us well over a thousand which should be an easy task for the forum members to achieve. I see so many other projects with lots of stars but for some reason it doesn't seem like it is something we tend to do around here, despite being a very active, friendly, and supportive environment. I also think that starring your favorite modules doesn't hurt either - I think that will also help to increase the visibility from PW and also help out module authors a little as well. If you can show your Github project has a decent number of stars it shows that you are building things that people want which can help you land a job and helps you to convince the client that you and ProcessWire are a good mix. Anyway, if you have a minute to do some starring of PW and your favorite modules, hopefully it will benefit us all a little. Thanks!1 point
-
1 point
-
Nice to hear that. I see some parts that could be improved but I think it's usable as it is now.1 point
-
You are a freaking star! This is brilliant! Love the implementation as well. This is why open source rocks - I owe you several beers (or other beverage of choice) for this one! Seriously made my day - client meeting in the morning and this is going to make things so much better.1 point
-
1 point
-
@adrian, sorry for the interlude - there was a power cut here. Not sure if you saw the edit to my earlier post: if the widgets are correct when you close the dialog but incorrect when you reload the page then it's an issue with this regex. But it looks correct to me - the pattern should match any number of characters after an opening delimiter up until a closing delimiter. You probably know more about regex than me though - does the pattern look right to you?1 point
-
Not really, only an addition to yours, that is, showing the "Check all" only on hover. But this of course would be unavailable on mobile which is not that bad imho.1 point
-
Version 1.8.1 adds Input mask feature and the misaligned bottom save button dropdowns should also be fixed. As for the phone country library for input masks (Cleave.js) I've added the all-in-one library which weighs about 250 Kb. It's not loaded automatically so you'll need to check it in the module settings page if you need it.1 point
-
I'm not aware of any way to do that. This module uses the widget component of CKEditor, and the dialog for that is defined once for all widgets in the CKEditor instance.1 point
-
Hi @adrian, I regularly use multiple Hanna tags within a single field and haven't seen that issue before. It sounds like the closing delimiter of the first tag isn't being detected for some reason. I'm thinking that there must be some content in your tag that interferes with the detection of the closing delimiter. Does changing to a different Hanna tag delimiter fix it? To debug you could try logging the "name" data attribute here, which should be the hanna tag contents without the delimiters. Edit: actually, if it isn't matching the closing delimiter when the page reloads then it's probably related to the regex here. But it looks correct to me.1 point
-
1 point
-
1 point
-
you're right! Tried to remove the cover over the link and make it smaller, so that one could click the Icon as well as the link. Somehow that did not work.1 point
-
1 point
-
Replace: $recipients = $this->wire('pages')->find($options['pages'])->children(); with: $recipients = $this->wire('pages')->get($options['pages'])->children(); You can't get the children of an array of pages. find() returns an array, get() returns a single page. Also, since you have Tracy installed, please use bd() instead of print_r() and make your life a little easier1 point
-
Hi @B3ta - I'm afraid I don't really have time to look into this at the moment. I am extending this module for my needs and I rarely have multi-language websites so it's not high on my list. I am happy to accept PRs though so together we can build a better version of this module. Once we are all happy with the stability/functionality of the new version I'll try contacting Nico to see what we can do about getting it into the main repo. Hope you understand where I am coming from.1 point
-
Thanks for pointing that out. I never changed that setting in production, so I didn't think of that. The latest github master (0.1.4) now uses the settings defined in TextformatterHannaCode's config both when inserting the pattern and as the trigger for autocompletion.1 point
-
What if you use import? https://developer.mozilla.org/en-US/docs/Web/CSS/%40import Write your common rules in the imported file, import the this file first in each file assigned to a CKEditor, and write the custom rules following the import. If you try it out, please report the result. I've never tested it with CKEditor in ProcessWire but I hope it works.1 point
-
Its not straightforward and sometimes frowned upon . Have a look at this thread. And this one: And this one for changing published date: OK, if you've decided to carry on, first, some quick by the way technical tips. If unsure whether something is a runtime or DB property, I check the API: http://processwire.com/api/ref/page/ For $page->created, it says: That gives me an idea that when setting, I should probably set in the same format (Unix timestamp). If unsure, I can check the code or try to pass it a normal formatted date. You never know, ProcessWire can convert it behind the scenes. I sometimes check the database table of the field. This case, the table is pages. This helps me to check out the schema and if the property is runtime or saved to DB. There they are. They are columns in the pages table. If need to, I also check the table structure, but don't need to in this case. OK, to the code. // CURRENT DATES // timestamps echo 'Created Date: ' . $page->created . '<br>'; echo 'Published Date: ' . $page->published . '<br>'; echo 'Modified Date: ' . $page->modified . '<br><hr>'; // formatted date echo 'Created Date: ' . date('D d M Y H:m', $page->created) . '<br>'; echo 'Published Date: ' . date('D d M Y H:m', $page->published) . '<br>'; echo 'Modified Date: ' . date('D d M Y H:m', $page->modified) . '<br>'; // MODIFY CREATED DATE $page->created = 1425898824;// Monday, 9 March 2015 11:00:24 $page->published = 1426762824;// Thursday, 19 March 2015 11:00:24// will not work; @see links to threads above $page->of(false); #$page->save();// @NOTE: WILL NOT WORK; you need below $page->save(array('quiet' => true));// @NOTE: ONLY WORKS FOR CREATED // MODIFIED CREATED DATE echo '<hr>'; // timestamps echo 'Created Date: ' . $page->created . '<br>'; echo 'Published Date: ' . $page->published . '<br>'; echo 'Modified Date: ' . $page->modified . '<br><hr>'; // formatted dates echo 'Created Date: ' . date('D d M Y H:m', $page->created) . '<br>'; echo 'Published Date: ' . date('D d M Y H:m', $page->published) . '<br>'; echo 'Modified Date: ' . date('D d M Y H:m', $page->modified) . '<br>';1 point
-
@Robin S Thanks, I'll have a look. Input masks continued from here I've managed to make it work on multilanguage installs, however, PW doesn't load the non-default field's value automatically (on the field config page). It's only a matter of a few extra lines but I feel this is a bug, or perhaps I'm doing things wrong. // $this->addHookAfter("Field(type=FieldtypeText|FieldtypeTextLanguage)::getConfigInputfields", $this, "addInputMaskConfigField"); $f = $this->wire('modules')->get("InputfieldTextarea"); $f->attr('name', "inputMask"); $f->label = $this->_("Input Mask"); $f->useLanguages = true; // setting value here, but this doesn't set for non-default languages $f->value = $field->inputMask; // need to iterate on languages and set each separately if ($this->wire('languages')) { foreach ($this->wire('languages') as $lang) { if ($lang->isDefault()) continue; $f->{'value' . $lang->id} = $field->{'inputMask' . $lang->id}; } } See the comments in the snippet, am I missing something? File size Another issue is that Cleave comes with many javascript files for phone masks, one for each country, that's about 3.4 Mb altogether. This would increase AOS size a lot (about 2.5 times as now), which I don't like a lot. Any idea how to overcome this? Should I load them via cdn? I've found bootcdn.cn only where they are available but I know nothing about that site. Or perhaps make it somehow available through $config->inputMaskAddons or something, and devs should take care of that if needed?1 point
-
I really need something like that many times. Perhaps a partial solution is a module based on Textarea that the Inputfield Type is an HTML editor with design blocks. I tried to develop one but since I'm not a "real" programmer, I could not make much progress. Maybe someone who knows how to develop modules in Processwire can do it, it does not seem very complicated. It was based on GrapesJS http://grapesjs.com/ an open source Javascript library and it is very easy to include it in a project https://github.com/artf/grapesjs#usage. Here you can see a working example http://grapesjs.com/demo.html, the library exports the HTML code that can be stored in the Textarea. You just have to include the CSS that the frontend uses to make it work.1 point
-
Yeah, similar experiences here. We have used a theme called The-7 (iirc) for 4 WP-sites. The theme had half a dozen variations of everything: 5 different tab elements, 7 accordion types, x sliders/carousels etc. etc. To ensure style consistency, we had to write a manual so authors could remember which items to choose and how. But tbh, I can fully understand why some ppl like such stuff. To most people, more is more.1 point
-
Got to agree with Kongondo: if that is doable for you, i.e. both sites sit on the same server, bootstrapping ProcessWire is probably your best bet. Otherwise I'd recommend checking out the REST API site profile and/or ProcessGraphQL. To my best understanding both provide the ability to create content via the API, and both have some sort of authentication mechanism available. Authentication is basically the main thing here: it's really easy to create a ProcessWire page that takes POST requests and creates pages etc. but you don't want, under any conditions, that to be publicly available without some sort of authentication. This is why I'd recommend checking the existing solutions first, and only rolling out your own solution if it's absolutely your only option1 point
-
current state: https://github.com/processwire/processwire/commit/8fe1eb13f4cbc85c6d5dad093fc559c438c92667#commitcomment-27795259 - sadly I will not have more time this week.1 point
-
Yes, do not hesitate to share your result, try to make your best and we will try to send a Pull Request on Github ✨ PS: I forgot to send my post. I modified the module to bypass confirmation, if you wanna try and report back, rename your LoginRegister folder to .LoginRegister, then extract the zip in place of the original one in site/modules, refresh modules and check the box in the module's admin. File : LoginRegister.zip1 point
-
First, some background to lit a light. There are some functions in PHP that may produce unexpected results in special situations. This functions are used by PW core files and in user contributed modules. Some users may have problems with file upload (pdf, zip, image, whatever) if filename has non-ascii character at the first place. For example, if user upload a file named "år.jpg" (year in Swedish language), it is expected that PW would transliterate (transform) the filename to "ar.jpg", but because of the bug in basename() PHP function, the filename would become just "r.jpg". Nevertheless the file would upload successfully. But if the filename is "привет.jpg" (Hi in Russian language) the upload would fail. There are two ways how to handle this: Write and use custom functions instead of builtin functions Let end user fix that with proper locale Option 1. is used in some CMS/CMF (like Drupal), PW (Ryan) opted for option 2. After successful login PW perform a test and warning is issued in case of test failure. It is now your responsibility to set proper system locale. The locale is a model and definition of a native-language environment. A locale defines its code sets, date and time formatting conventions, string conversions, monetary conventions, decimal formatting conventions, and collation (sort) order. Those "problematic" builtin PHP functions are locale aware, that means they work as expected, if locale is configured appropriately. Locale can be set by the underlying operating system or in PHP. Because on shared hosting you don't usually have root access to the OS, the only option to set the locale is by using the builtin setlocale() PHP function. But, before you can use/set the locale, it must first be installed on the OS. On most unix systems at least some basic locales are already there, they are just not used. To check what locale are you currently using and what locales are available for you to use, create the file testlocale.php at the root of your website with the following content: <?php echo "<pre>Current locale:\n" var_dump(setlocale(LC_ALL, '0')); echo "\n\nAvailable locales:\n"; echo exec('locale -a'); Then point your browser to http://yourwebsite/testlocale.php If your current locale is "C" (and you are on unix), then you will probably get warning after login to the PW admin. What you want to do is change the locale to something that has "UTF-8" or "utf8" in the name of the available locales. In your case you would be looking for something like "sv_SE.UTF-8" or "sv_SE.utf8". Now, there is a chance that Swedish locale is not installed. You can ask your hosting provider to install it for you or use some other UTF-8 locale. On most unix systems I have seen, at least "en_US.UTF-8" or "en_US.utf8" is installed. If even that English locale is not available, then look for "C.UTF-8" or "C.utf8". And this is what you have to use as parameter in the setlocale() call: setlocale(LC_ALL, "sv_SE.utf8"); You could actually "stack up" multiple locales and one will eventually work: setlocale(LC_ALL, "sv_SE.utf8", "sv_SE.UTF-8", "en_US.UTF-8", "en_US.utf8", "C.UTF-8", "C.utf8"); Now, regarding where to put that setlocale() call. If you are not using PW multi language capabilities (you don't have Languge Support module installed), then you place setlocale to /site/config.php. That's it. If Language Support module is installed (PW checks for that), you have two options: Translate the string "C" in LanguageSupport.module for each installed language Put setlocale() call in /site/init.php My preferred method is option 1 and this is what PW (Ryan) recommends. See https://processwire.com/api/multi-language-support/code-i18n/ for more info on translating files. Option 1 allows you to set different locale for each of the installed language, while option 2 allows setting of one locale for all languages. PW will also provide links for the files that needs to be translated in the warning message. Ryan just pushed an update that makes it use the locale setting on the frontend when using LanguageSupportPageNames module (until now just language was changed, but not locale). Also setLocale() and getLocale() methods are added to the $languages API var.1 point
-
Very strange one... I have 2 Fields set to 50% in template context (here a screenshot of the default profile). In the default admin it works as expected (headline + summary side by side), but in the uikit theme they are not the width that they should be Any ideas? I thought this might be AOS but I tried it on a fresh DEV installation and same result.0 points