Leaderboard
Popular Content
Showing content with the highest reputation on 10/20/2022 in all areas
-
The module originated from an idea/discussion in this thread. I hope that helps to see more PRs for improving the PW backend ? https://github.com/baumrock/Scss Watch core files When working on PRs for the ProcessWire backend you'll notice that the core ships with several SCSS files and the corresponding CSS files. To make it easy to work on the SCSS files without the need of adding complicated build tools to your project you can simply install the Scss module and add the following in /site/ready.php $modules->get('Scss')->watchCore(); Now your SCSS files will be watched for changes and once you change something and reload your page you'll get the new CSS on the fly and can commit both changes ?5 points
-
@tires, if it's working for you then great, and I don't really get how URL segments relate to what you're doing, but what I was suggesting is to use hooks like this: // Add return GET variable to form action URL so it's available after the login form is submitted $wire->addHookAfter('LoginRegister::buildLoginForm', function(HookEvent $event) { /** @var InputfieldForm */ $form = $event->return; $return_id = (int) $event->wire()->input->get('return'); if($return_id) $form->action .= "?return=$return_id"; }); // If login is successful... $wire->addHookAfter('LoginRegister::loginSuccess', function(HookEvent $event) { $return_id = (int) $event->wire()->input->get('return'); // ...and there is a return page ID... if($return_id) { // ...check that the user can view the page and if so redirect back to it $return_page = $event->wire()->pages->get($return_id); if($return_page->id && $return_page->viewable()) { $event->wire()->session->location($return_page->url); } } });4 points
-
I’ve made a different wild guess https://github.com/JanRomero/processwire/commit/1641e1681ae20fb01ca0ec3568da0832fb3337b1 It’s messed up because my editor uses spaces by default and PW uses tabs, also I did it on the master branch because I’m an idiot, but whatever. Works okay, looks like this: And this is the list view: I would not merge this though ? Edit: oh yeah because it uses an <a> inside the <label> you have to hit the icon quite precisely, even though the cursor changes over the whole label. Well, I don’t mess with SCSS… @bernhard Thanks for the like, finally I’m a hero member ? Took me long enough3 points
-
Would be great if anybody could tackle this. Meanwhile I've created a new module that does the SCSS compiling on the fly ? Scss Module to compile CSS from SCSS Watch core files When working on PRs for the ProcessWire backend you'll notice that the core ships with several SCSS files and the corresponding CSS files. To make it easy to work on the SCSS files without the need of adding complicated build tools to your project you can simply install the Scss module and add the following in /site/ready.php $modules->get('Scss')->watchCore(); Now your SCSS files will be watched for changes and once you change something and reload your page you'll get the new CSS on the fly and can commit both changes ?2 points
-
Bro, I feel very sad for you in term of having fun while developing (working). I feel lucky to be one of those guys who can refuse tasks that should be done on these pieces of software mentioned above, even more when you worked with ProcessWire. However, it is true that you have to take into account an "architecture" already in place. Bosses are "afraid" of change that concerns the backbone of their business, especially when it works as is. What I would do personally, - it also depends on the "size" of the internal architecture and context - would be to rewrite the mess under processwire in your spare time and give them a demonstration of why and how it's better, with arguments about the added value in terms of maintaining and possible future hiring of developer(s). I think it's easier and safer to hire "pure" developers rather than "closed and trained" developers on a given CMS (multi-skilled). I mean there, a pure PHP developer can jump on ProcessWire, where like a guy like me, can't take the other the opposite way. "courage brother"..2 points
-
Nice to know nonetheless for a mac newbie ? But today I had an SVG that was not displayed so your proposed solution would also not work I guess ? My request is also an attempt to get more contributors to PW and to get more PR's for little and easy to add things ?2 points
-
Hi, just my two cents ? for a front-end login page, url segments could be your friends (the page to be redirected id, name or whatever you want) a little regex to keep them safe, it wouldn't change the login url and you could grab it like a var, same thing as what @bernhard has highlighted for the pw native login have a nice day2 points
-
This is exactly what creates the upgrading problem that Ryan is trying to avoid, since data is in HTML already in all processwire installs.1 point
-
Hi @kongondo and many thanks for this great module. I just installed it on PW 3.0.200 / PHP 7.4 and encountered an issue with uploads of SVG, be it from the MM Upload section or the mm field that I created for type images. FileValidatorSvgSanitizer is also installed. There is a PHP Warning related to JqueryFileuploads module Problem is the getImagesize($imageFile) call which returns false for SVG images. I scanned the JqueryFileuploads thread for posts related to SVG and found none. Wondering if I'm the first one encounterng this. Maybe because it is "just" a Warning and not and Error. I have set Tracy Debugger to strict mode in all of my projects. On https://www.php.net/manual/en/function.getimagesize.php they explicitly say not to use getimagesize for detecting mime size and recommend https://www.php.net/manual/en/function.finfo-file.php instead. Is it possible to make the option allowedImageMimeTypes configurable through module settings or to hardcode image/svg+xml as allowed image mime type into the module? This would make it easier to do mime type validation for svg with finfo_file(). Something like // if (function_exists('exif_imagetype')) { ... } elseif (function_exists('finfo_file')) { $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension if (in_array(finfo_file($finfo, $imageFile), $allowedImageMimeTypes)) $isValidImage = true; } // ... Or https://www.php.net/manual/en/function.mime-content-type.php is also an option. Feel free to move this to the JqueryFileuploads thread.1 point
-
The code before was just a wild guess. But I have now tried it and it could work like this: // Add the download label to $this->labels // Somewhere at the beginning of ___renderButtons() $downloadUrl = $pagefile->url; // In ___renderButtons() for example after variations // Download $buttonText = "<i class='fa fa-download'></i> $labels[download]"; $buttonText = str_replace('{out}', $buttonText, $this->themeSettings['buttonText']); $out .= "<a class='$buttonClass' href='$downloadUrl' download>$buttonText</a>"; Here is a screenshot: If you make it to a link styled like a button and add the download attribute, there is no need to open a modal and it would download the file with just one click.1 point
-
Just my proposition, but maybe this option would be better located under the image edit buttons: https://github.com/processwire/processwire/blob/3acd7709c1cfc1817579db00c2f608235bdfb1e7/wire/modules/Inputfield/InputfieldImage/InputfieldImage.module#L767 Because it is not a common option for everyone and the risk would be, that you download the file by accident if it is a button inside the image. Also you wouldn't have to change the SCSS file. It would be just something like: // Download $buttonText = "<i class='fa fa-download'></i> $labels[download]"; $buttonText = str_replace('{out}', $buttonText, $this->themeSettings['buttonText']); $out .= "<button type='button' data-href='$downloadUrl' data-buttons='button'>$buttonText</button>";1 point
-
I know that this is not the answer you are looking for, but at least on macOS I always open the image with the lightbox and then drag&drop the image on my desktop. That is not as convenient as a download icon, but three clicks less than Right click => Save image as.. => Select folder => Save ?1 point
-
Being able to download full-scale images, including SVG's, directly from an admin->page-edit->images field via a single click on an icon would be a great feature1 point
-
So, after 5+ years of being a ProcessWire dev, I've bagged my first multi-lang project. Be prepared for questions ?1 point
-
You could also create pages that only have the code field and then reference as much snippets as you want with something like [code=123] where 123 is the page id. Or you use https://processwire.com/talk/topic/18289-processmention-forum-mentions-style-page-link-autocomplete-for-ckeditor/ then you could even include code snippets without any "coding". Or you use RepeaterMatrix to build a pagebuilder like experience.1 point
-
hi, wow, thansk a lot @bernhard i didn't know this module and it looks fantastic i think that it's not exactly what @DansDomain was looking for because the full field is managed by the syntax higlighting you choose instead of being able to post a snippet inside a long piece of "normal" content but it gives me an idea, using ACE for a field, CKEditor for the text content and hannacode to insert the full code field into the CKEditor one, even two or three little snippets and hannacode with the name of the fields as a variable well, sure when you have a lot of little snippets it's probably easier to use the codesnippet plugin and apply classes to the code tags to have them stylized on the front end but i can imagine cases where this ACE/hannacode solution would be very useful thanks again and have a nice day ?1 point
-
Many thanks to both of you! I solved it this way and put the following hooks in my site/ready.php ... First hook to grab the URL: $this->addHookBefore('ProcessLogin::buildLoginForm', function(HookEvent $event) { // --- Split URL --- // $actual_link = explode('/',(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); // --- Putting the last i.e. fifth part of the URL in a session cookie "weiterleiter" --- // $this->wire('session')->set('weiterleiter', $actual_link[5]); }); Second hook to redirect after login: $this->addHookAfter('Session::loginSuccess', null, function($event) { // --- Get session cookie "weiterleiter" and write it in $weiter --- // $weiter = $this->wire('session')->get('weiterleiter'); // --- If the $weiter is not empty add the path and write it in $url --- // if(!empty($weiter)) $url = "artikel/".$weiter; // --- Redirect to the URL --- // $this->wire('session')->redirect($url); // --- Delete the session-Cookie ---// $this->wire('session')->remove('weiterleiter'); }); That works for me! Is there a smarter way to do this? Or a smarter way to get the url by segments?1 point
-
You could also use this if I'm understanding you correctly:1 point
-
Yeah I agree it's quite a hidden feature. Similar to the double-click-delete on files/images... I think there has been some discussion about it some time. Maybe it was a github request, don't know ? But a note would certainly not hurt here ?1 point
-
Sorry to hijack the thread, but... would you believe that I literally just learned that you can do this with checkboxes? That makes things so much easier. I've always considered this part of the admin pretty cumbersome, having to click all those checkboxes one by one ? (Perhaps this view should include a note about this, unless this is something that everyone else already knows about?)1 point
-
Thanks, @teppo information and example, now it's more apparent to me how and where this feature could be used.1 point
-
Hey @Zeka! I assume you're referring to "method aliases" from MethodPropsTrait? If so, this is a feature that, to be honest, I've not had much use for myself. As far as I can remember, the original intention was two-fold: 1) Whether to make code cleaner or to mitigate issues resulting from partial rewrites, one can create an alias or "virtual method" that calls another local method behind the scenes. Say, if a controller class had method called "words", but later it was decided that it should be "terms" instead (or for some reason front-end code requires it to be that) yet changing it now could potentially cause other issues, one could handle this via an alias: class DictonaryController extends \Wireframe\Controller { protected $method_aliases = [ 'terms' => [ 'callable' => ['self', 'words'], 'params' => [], ], ]; public function words(): array { return $this->pages->findRaw('parent=' . $this->page->id . ', template=Word', [ 'name', 'title', 'dictionary_category.title', ], [ 'objects' => true, 'entities' => true, ]); } } Here I'm defining the $method_aliases property directly on class declaration, but in some cases it could make more sense to define individual aliases via the API: $this->setAlias($alias, $callable, $params). 2) Another use case is referring to a method defined somewhere else — another controller, utility class, third party library, etc. Essentially this makes it easy to inject new methods or properties into classes implementing the MethodPropsTrait (such as controllers and components): class DictonaryController extends \Wireframe\Controller { public function init() { $this->setAlias('terms', '\Wireframe\Lib\Utils::getWords', ['page' => $this->page]); } } You can do the same with ProcessWire hooks or just have a method that calls another method, so this is largely a matter of preference ? --- As I mentioned above, I've not had much use for this feature myself. It's been there since the very beginning, and it's a concept that seemed potentially useful (not to mention fun) while I was working on the initial implementation of Wireframe, but real world use cases have been few and far between. If you can think of other use cases, let me know ?1 point
-
First off, I won't stop developing ProcessWire unless I'm dead. But lets say that one of you showed up at my door and shot me, and then I'm gone for good. This is free software and you don't get any guarantees there, no matter what CMS it is or how big the community or adoption of it is. But what you do get is the source code and permission to use it and do with it what you need to. There is far more security in that than any proprietary or commercial system. We should all feel very lucky that this project has attracted such a capable development community around it (more than any project I've ever seen), and there are several guys here that are fully capable of taking over the project if I go down in a hang-glider crash. I'm always reluctant to list off people because there are so many people that contribute to the core and I don't want to forget anyone. Suffice to say, I may hold the keys to the master GitHub account, but this is a project of many developers, at least 5 of which are fully capable of taking over the project if I kick the bucket. I'm certain that some of these guys could do better than me with it. Please don't take that as an invitation to show up at my door with a weapon. But I would suggest this may be better odds than with the bigger projects you'd mentioned. Lets also point out here that ProcessWire is not WordPress–it does not need daily updating in order to keep running. Most sites I build with ProcessWire are running the version they are launched with. With ProcessWire, you do not need to upgrade your site every time a new version comes out. You can generally upload it and forget it, and it'll keep running till the site as long as the server itself is running. What other CMS can you say that for? (I can't think of any) Personally, I think adoption of something like Drupal, Typo3, Joomla, etc. is more of a risk, because you are dealing with a legacy platform – you are adopting technology from 10 years ago. You are also adopting something that is a target for hackers and spammers. WordPress is perhaps the biggest target, and something I've very apprehensive to setup for clients. Ultimately when a company chooses to adopt a legacy platform because "it's what the clients know" or [more likely] what they themselves know, it's a lazy decision. It's not looking out for the clients' best interests, and it's pursuing mediocrity. When you pursue mediocrity, you pay for it in the long run. There is no better testament to that than the legacy platforms that agency seems attached to. 1-3 years after installing [Drupal/Joomla/Typo3/WordPress/etc.] for the client, they are going to be looking for "something different" in terms of the CMS (we all know this) and they won't be coming back to the same agency. The agency that thinks it's playing it safe is really just hurting themselves when they give their clients something tired and mediocre that anyone can give them. Instead, give them ProcessWire, and they'll know you are different and better (a secret their competition does not have), and they'll be a lifetime client.1 point
-
As 1st of november the company I work for is going to be integrated into an another, bigger, one where Drupal is the main web driver other developers work with. This is something I have to adapt with, due to the fact that I'm the only one I know, and love, to work with Processwire for web development. I have plans to diffuse my knowledge with PW and convince to use it for all the sites we are going to develop, but right now I'm not very confident to be successful in the short/mid term. I've spent the last two days trying to figure out the mechanisms and the paradigms behind Drupal but the more I discover the sadder I get. Concepts likes regions, blocks and content types don't sound that bad, but bad and alien is their way to act together. Way more intricate and anti-logic as I'm used with PW, where its logic when working with data arises and shines. Moreover there are template files naming convensions, which you must stick with in order to build site pages and pay a good amount of attention to not reach to an "inception-like" structure, an announced mess. There is twig as template engine, which I don't know (yet) but that's the easy part I'm not worried about. Oh...and the design and UX of the backend sucks, IMHO. So, after this good amount of complaining I'm here to ask if some of you with previous experience with Drupal could give me some advices on how to grasp the basics and learn a workflow as similiar as PW can offer. Links, tutorials, modules and whatnot are very welcome from you (virtual hugs too ? ) Thanks in advice. Lorenzo0 points