-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
Via a RockMigration ? $rm->migrate([ 'templates' => [ $this->template => [ 'icon' => $this->icon, 'tags' => RockChimp::tags, 'fields' => ['title'], 'parentTemplates' => [RockChimp::tpl_messages], 'noChildren' => 1, 'noSettings' => 1, 'pageClass' => '\RockChimp\Message', 'pageLabelField' => "fa-{$this->icon} {title}", ], ], ]);
-
I'm using the "noSettings" property of the template. I've changed my setup, so I can't test it any more. As it works for you I don't want to investigate this one ?
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
bernhard replied to kongondo's topic in Modules/Plugins
Hey @psy I'd create a custom runtime module, it's not too hard: 1) Create the fieldtype: 2) Create the inputfield: RockMarkup is deprecated because I don't plan to use it as base module for other Fieldtypes in the future. I think it makes things more complicated and that's not worth it. Building custom fieldtypes + inputfields is easy once you know how things work. Especially runtime fields are easy because you don't need all the DB related parts. If you need any help just ask. -
Hi @Andi Interesting, thx for sharing ? I've had a similar strang issue lately where utf8 encoded whitespaces where an issue. Why don't you put that code in a saveReady hook so that it is done automatically on every page save? Even better would be a little module so that you can share it with us ? // info snippet class Classname extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return [ 'title' => 'Classname', 'version' => '0.0.1', 'summary' => 'Your module description', 'autoload' => true, 'singular' => false, 'icon' => 'smile-o', 'requires' => [], 'installs' => [], ]; } public function init() { $this->addHookAfter("Pages::saveReady", $this, "replaceBadUmlauts"); } public function replaceBadUmlauts(HookEvent $event) { $page = $event->arguments(0); $bad = array("ü","ö","ä","Ü","Ä","Ö"); $good = array("ü","ö","ä","Ü","Ä","Ö"); $page->summary = str_replace($bad, $good, $page->summary); } /** * Config inputfields * @param InputfieldWrapper $inputfields */ public function getModuleConfigInputfields($inputfields) { return $inputfields; } } In the module config you could add an asm field to select the fields where the replace should happen
-
Hi @adrian are you aware that the page rename seems not to work if the settings tab is disabled on a template? Is that intentional? Not a big deal for me, just realized it during debugging an issue on my site and wanted to let you know ?
-
How to use a page object representing an external link within CKE?
bernhard replied to HerTha's topic in General Support
Never tried this module, but it looks like this is what you are looking for: -
CKEditor - Justify Preinstalled on Textarea Fields
bernhard replied to prestoav's topic in Wishlist & Roadmap
Hi @tpr the FieldOverrides look neat ? I've never used them but I have a similar module that can override field settings based on template etc. There's one problem though: Setting options for ajax fields does not work with my approach that hooks in buildForm ? So for example I can't set Image field settings like maxSize or allowed extensions because they have no effect when someone uploads a file. Do you have the same limitation in your approach?- 11 replies
-
Just create a module and a script that saves all this information to a file: This data could easily be saved as JSON. Maybe there are already methods that do this (I think so, because using the GUI a JSON is written into a textarea. Just look there how it is created). Of course you don't want to run this on every page request. I don't know what the best hook would be. A simple solution would be to run on every Modules::refresh()
-
You could easily use the export data methods available for processwire fields and templates and store that export in a folder. Having this folder under control of GIT you'd get a changelog of your system.
-
German language pack (de_DE) with formal salutation
bernhard replied to dotnetic's topic in ProcessWire Language Packs
Hi @dotnetic thx for your efforts on the translations! Could you please change this to -
Load External PHP Library Using WireClassLoader
bernhard replied to Gadgetto's topic in General Support
Sounds good ? I really don't know much about composer. I just know the basics to get things done - so if you have suggestions for improvements (with a little more details so that a composer noob like me can understand it quickly ? ) I'm happy to change the simple approach used in some of my modules ? -
RockNette - Wrapper to integrate Nette Framework into ProcessWire
bernhard replied to bernhard's topic in Modules/Plugins
Some Examples: 1) I've used Tokenizer to render search results: 2) I'm using the nette mailer for perfect e-mail scores using DKIM: 3) I've used Nette Forms for custom Form implementations with Backend + Frontend validation 4) I've used some of the image manipulation functions: https://doc.nette.org/en/3.0/images -
Making automatic migrations is not possible. That's because migrations need to know the order of several actions (first this, then that, then that). For example you can only assign a field to a template once the template exists.
-
This was my approach ages ago, but I'm not using it anywhere any more, because I'm using RockMigrations for all my sites ?
-
Just added the feature to parse multiple LESS files into one single CSS (file or string), bumped the version to 1.0.0 and updated the readme (proper docs) ?
-
Aligning things is tricky, but most things work using nested tables (that's what I meant when saying "like 20 years ago"). What about this? $pdf = $modules->get('RockPdf'); $table = ' <style> td { border: 1pt solid black; } .center {text-align: center;} </style> <table>'; $table .= '<tr><td class="center">foo</td><td>bar</td></tr>'; $table .= '<tr><td>Donec vitae sapien ut libero</td><td>Donec vitae sapien ut libero</td></tr>'; $td = "<table><tr><td class='center'>sub-heading</td></tr><tr><td>Phasellus ullamcorper ipsum rutrum nunc</td></tr></table>"; $table .= "<tr><td>Donec vitae sapien ut libero</td><td>$td</td></tr>"; $table .= '</table>'; $pdf->write($table); d($pdf->save()); // generate pdf
-
Here you go: Not sure if it should also strip ?
-
Stripping off empty paragraphs can be harder than it may sound: As requested by @netcarver I put it into a textformatter module: https://github.com/BernhardBaumrock/TextformatterRemoveEmptyParagraphs https://modules.processwire.com/modules/textformatter-remove-empty-paragraphs/ TextformatterRemoveEmptyParagraphs ProcessWire Textformatter to remove empty paragraphs from CKE fields Removes empty paragraphs from a html string. A paragraph is considered to be empty if it only contains one or more of the following: regular whitespace UTF-8 encoded whitespace all variants of <br/> PS: I'm actually not sure if that makes sense as Textformatter at all. IMHO this should be done on processInput, so it's more a sanitization than a textformatter... @netcarver what do you think, as you requested this... ?
- 1 reply
-
- 3
-
-
v1.0.11 pwtextformatter: PW Textformatter Boilerplate
-
This one caught me today ? Thx to @netcarver and @Robin S I came up with a working solution: $html = $page->getUnformatted('rr_cke'); $html = preg_replace('!<p[^>]*>([\xc2\xa0]*|\s| |<\/?\s?br[^>]*\/?>)*<\/?p>!', "", $html); // remove empty paragraphs $html = $sanitizer->markupToText($html); // remove all tags $html = preg_replace('![\r\n]+!', "\n", $html); // replace multiple newlines db($html);
-
Exactly! And doing stuff in the backend has also one more major benefit: You do not expose user-input forms on your frontend! That means you let processwire handle the access control part and only build the parts of custom logic that you need.
-
Alternate posting methods - email / browser extension
bernhard replied to Mikie's topic in API & Templates
At least this seems to be solved already: https://modules.processwire.com/modules/process-email-to-page/ I have never developed a browser extension myself, but I guess it should not be too hard. The extension could send the URL to your PW and there you could do anything with that request. You just need to make sure to do proper sanitization of the data and that only allowed users can post data to your system (eg. via a secret token).