Leaderboard
Popular Content
Showing content with the highest reputation on 06/25/2019 in all areas
-
3 points
-
@stuartsa, you can achieve a step setting for InputfieldInteger / InputfieldFloat / InputfieldDecimal by a couple of hooks in /site/ready.php: // Add a step setting to InputfieldInteger / InputfieldFloat / InputfieldDecimal $wire->addHookAfter('Inputfield(className=InputfieldInteger|InputfieldFloat|InputfieldDecimal)::getConfigInputfields', function(HookEvent $event) { $inputfield = $event->object; $field = $inputfield->hasField; if(!$field) return; /* @var InputfieldWrapper $wrapper */ $wrapper = $event->return; /* @var InputfieldText $f */ $f = $event->wire('modules')->InputfieldText; $f->name = 'step'; $f->label = 'Step'; $f->value = $field->step; $f->showIf = 'inputType=number'; $wrapper->add($f); }); // Add step attribute to InputfieldInteger / InputfieldFloat / InputfieldDecimal $wire->addHookBefore('Inputfield(className=InputfieldInteger|InputfieldFloat|InputfieldDecimal)::render', function(HookEvent $event) { /* @var Inputfield $inputfield */ $inputfield = $event->object; $field = $inputfield->hasField; if(!$field || !$field->step || $field->inputType !== 'number') return; $inputfield->attr('step', $field->step); });3 points
-
Chaining is based on the idea that your method returns a self-reference, i.e. "return $this", after which you can access another method from the returned object. In your example when you leave $value param of the text() method empty (so that it defaults to "null"), the method returns "$this->text" (which is a string or null) instead of an object – and you cannot use a string (or null) for chaining (it doesn't have any methods). In other words: even if "$this->text" had a non-null value, you still couldn't use it for chaining, 'cause it would return a string and not a self-reference to the containing object ? Based on your code it looks like text() without a $value is supposed to work like a getter, returning the text (string), so technically this is how it's supposed to work. The most obvious option would be defining another method – perhaps something like setText(string $value = null) – that sets the value but always returns $this, and never the value itself. Or you could just modify the text() method so that it cannot be used as a getter for the value, i.e. make that always return $this. Hope this helps a bit ?2 points
-
Hey gents. I've been asking myself this question for quite a while now and even though I've completed some projects purely and entirely out of PW core + free modules, I've been always envy of the simplicity in code and to minimize the database/website load. As it appears, in times when I had to revise some of the profiles code I was finding a better and simpler approach based on some shared recent or good old (but not forgotten) tricks by all the smart persons presenting this amazing ProcessWire community. The more I analyze the code, the more strong need I feel to get the ProFields module for several reasons: a.) All the advice and help that have lead me to my present skills were kindly given absolutely for free with no questions asked and no matter if the answer was helping me generate some revenue. I am 100% convinced that I "owe" back to the community and its major developers the support (my 5 cents back ? ) b.) Being a bit selfish - I would really like to spend less time on a project while still delivering the same if not much better and simpler solutions. To achieve all this, I would need the tools kindly included in the "ProcessWire toolbox" called ProFields. Initially my plan was to build a few profiles, generate some revenue and then spend some of the finance to purchase the tools needed, however most of the profiles I've built were for personal or close friends/relatives from which I did not generate much out of respect. But I've learned that with the proper tools, even when I am "working for pennies" I can complete the project faster/easier and move on to the next of kind. c.) As it was previously mentioned, everybody is in a need of a stable financial position as otherwise no matter how good is the will, everything seems to be doomed to an end of a failure. By buying the ProFields module, I would not only support the respectful development team, but also the community itself as the new releases, modules, tweaks etc. would keep on going. To me - this seems like a healthy recipe of success. d.) Not sure about others, but at least in Canada I am allowed to claim some work related expenses while working as a self employed, so I have a choice to either give/share my money with the developers team or to give them to the government in the form of taxes. Well, let's just say I got tired of paying taxes ? e.) The words: "free for life" or "use on as many websites you want" got me by surprise. Most of the platforms I am aware of are selling their licenses per user, per device, per website etc. but I have not seen a single one stating that I can use a bunch of modules to sell websites etc. and that can go on and on to as many users as I can convince of my skills. I have some pre-sale questions, but I am sure that everything is as well covered as it is with all the freebies so I will not pose some, wait for answers and waste more time on this. I am about to start working on a new project where I clearly stated that without the tools I need, I won't be participating so I am very much eager to start "playing" soon with all the masterpieces included in ProFields. I just wish that the price was in Canadian dollars or at least I've bought the license at the time when CAD to US was 1.04 to 1, but hey - it is an economy driven situation so there is no one to blame on this other than myself waiting for so long.2 points
-
I've been working on this a looks like it WILL require a change, as it now requires you update your payment journey to use PaymentIntentions, e.g. setting a intent to pay at the beginning of any payment checkout before actually requesting card information, address, email etc etc... I'm currently having to do this for my clients and adding support for Stripe Elements. Love this to be robust butI'm simply not a very good backend dev so muddling through it. Will release what I have when it's done hopefully in a week.2 points
-
TLDR: Buy ProFields I don't understand why that brief list of fields is a "mess and a nightmare". I know the general advice given is to reuse fields where possible but I think people sometimes take this suggestion a bit too seriously. Create the fields you need and forget stressing about whether you have perfectly optimised the reuse of fields. If you have less than, say, 100 fields in your site you really have nothing to worry about. I think I saw a post recently where Lost Kobrakai was talking about a site of his with over 800 fields. But ProFields... You mention client editing experience, so I take that to mean you (like me) earn an income from developing websites. With that in mind here are some things to consider when making your decision whether or not to purchase ProFields... Have you thought about how lucky we developers are that we can earn an income with virtually no overhead costs? With so much fantastic open-source software made available to us at no cost we are in a very fortunate position. We could design and develop websites entirely with free software if we so choose. Hell, if we wanted we could go to the landfill and probably pick up a free old computer that would be perfectly adequate to develop a website on. Now think about the carpenters and dentists and all those other professions that must purchase real physical tools (that wear out) in order to earn a living. £100 doesn't go very far if you need to buy a table saw. On the topic of open-source, think about what Mr Ryan Cramer has provided us with in ProcessWire. People with his level of skill do not need to be contributing their time for free to open-source projects - they are in very high demand for all kinds of lucrative work. Purchasing a Pro module from Ryan is a way to show appreciation for the generous work he puts into PW. PW is not just great free software, it is great software full-stop. You mention previously having worked with Drupal and Craft CMS. Time is money, so think of all the money you have saved by the quick development workflow that PW allows vs Drupal. And Craft CMS costs USD$299 per website and is still not as powerful as the PW core. Ryan's Pro modules are insanely good value for money. The price that you can purchase a dev license that allows you unlimited use of the modules is more than reasonable. For comparison, here is one of the most popular addons for Concrete5: http://www.concrete5.org/marketplace/addons/block-designer-pro There is no unlimited license, and a license for 5 installations costs USD$276.25. And it requires "Block Designer" so that's another USD$120 for 5 installations, bringing the cost to USD$396.25. I haven't used it but it looks like it is basically the equivalent of Repeater Matrix. But probably not as elegant. And with ProFields you get another four modules bundled in. For unlimited use. For USD$129. Hope this has helped make the decision a little easier.2 points
-
1 point
-
Wow... I have actually never seen this before but for external links I use:1 point
-
Nope Iam no longer sure, turned out to be 5.6 set in cpanel and 7.2 in whm. ? Thanks for your help ?1 point
-
The line in question is: $isTranslatable = $info['translatable'] ?? false; The "Null coalescing" operator was introduced with PHP 7 - are you sure you're using PHP 7.2? ?1 point
-
$page->images->slice(0, 5)->implode(function($image) { return "<li><img src='$image->url' alt='$image->description'></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); This would be the processwire api equivalent. From looking at the perch example I'm wondering if they use it for creating templates based on the markup. Otherwise I'm not sure why a lable would be given here.1 point
-
Just did that. https://github.com/processwire/processwire-issues/issues/9141 point
-
WOW did you seriously just build this?! Thanks a lot!! Very educational code. I'll just rip this from the Perch documentation: <perch:repeater id="images" label="Images" max="5"> <perch:before><ul></perch:before> <li> <img src="<perch:content type="image" id="image" label="Image">" alt="<perch:content type="text" id="alt" label="Description">"> </li> <perch:after></ul></perch:after> </perch:repeater> I THINK I could also see how something like this could be implemented too. Anyway, thanks a BUNCH, I might work on your proof of concept a bit further down the road.1 point
-
I tested your setup in a VM but with a Linux distribution instead of a Windows and as a result , ProcessWire run smoothly on it, even the default search feature. I will install a Windows server today just to see if there is an extension which could mess the setup. Stay tuned..1 point