Leaderboard
Popular Content
Showing content with the highest reputation on 11/11/2019 in all areas
-
Github: https://github.com/theGC/WireMailSendGrid What it does: Extend WireMail to bypass PHP mail and send mail via SendGrids Web API. What you need: A SendGrid account, use this to generate an API Key with Full Mail Send permissions. Once installed, the API Key is popped into the modules config and you should be good to go. Use Cases: It simplifies the process of sending email from servers by removing the need to configure sendmail or other email routing applications on the server. Instead it relies solely on PHP and offloads the sending to SendGrid which can be heavily configured via its UI to ensure better delivery rates for your domain.4 points
-
The Inputfields JS API is really cool, thanks @ryan! What do you think about adding a feature so that some (all??) of these JS functions could be triggered via URL query string parameters? As per my request here it would be neat to be able to create links (e.g. modal) to a form that automatically show/hide/highlight/etc particular fields.4 points
-
Hey @guy, thanks for sharing this! Unless I've missed something important, note that your module doesn't actually have to hook into WireMail::___send() – it's a WireMail module, so it should implement its own ___send() method instead. This is how WireMail modules are designed to work, and it also guarantees proper interoperability in the case that other WireMail modules are installed ? See WireMailMailgun for a reference.3 points
-
The simple solution is to create a new text field "full_name" and add it to your template. Set the visibility to "Hidden (not shown in the editor)". In /site/ready.php: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'your_template') { $page->full_name = $page->first_name . ' ' . $page->last_name; } }); You'll need to save all the pages once to populate the full_name field - if there are a lot then use the API to loop over the pages and save them. Now you can search the full_name field.2 points
-
I need to take a look at that, but unfortunately, I'm not hopeful that I'll find enough time this week. Next week should be a bit less crazy though. I haven't found the time to update to the latest FB release, but it looks like soon will be a good time to do so ? Stay tuned.1 point
-
@teppo thanks pal Yeah I noticed as soon as this was uploaded. Just tweaking it now but as you say no need for the hook as allows it to play better with other WireMail modules.1 point
-
Do not use FieldtypeInteger for Phonenumbers, because the Mysql Datatype is INT and therefore the value is limited to 4 bytes strings (32bit). You can use FieldtypeInteger only for numbers within the range from -2147483647 to 2147483647. Use builtin FieldtypeText or FieldtypePhone (3d Party Module) for Phonenumbers. The value of FieldtypePhone must be an instance of Phone (WireData derived object) otherwise it will be set to blank value. From the code: /** * If value not of instance Phone return empty instance */1 point
-
This is possible if you use a hook to build the dialog form. See the example in the module readme. You would define the options like this: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'your_hanna_tag_name') { $modules = $event->wire('modules'); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'Post_sorting_order'; $f->id = 'Post_sorting_order'; $f->addOptions([ 'recipe_comments.count' => 'Recipe comments', '-recipe_comments.count' => 'Recipe comments (descending)', // etc ]); $form->add($f); } }); Or if you don't want to use a hook you just need to do the work of converting the labels into the values you want to sort by in the Hanna tag code. For example: switch($Post_sorting_order) { case 'Recipe comments': $sort = 'recipe_comments.count'; break; case 'Recipe comments (descending)': $sort = '-recipe_comments.count'; break; // etc }1 point
-
@Jonathan Lahijani Showing the namespace (matrix4) is something new to this version of PW, and it can do that because namespaces of fields within a fieldgroup are a core concept. So this is an extra that we didn't have before, but that I think is worthwhile here. However, Repeater Matrix is a module, and not even a core module, so things like RepeaterMatrix type names/labels are not known to the core. Part of ensuring the core remains flexible and maintainable means that it does not get involved in the implementation details of specific Fieldtypes. It just knows the Fieldtype interface, which is common to all Fieldtypes. So there's no reasonable way for us to have this particular core Process module identify labels of matrix types to show here. When it comes to RepeaterMatrix, the preferable way to edit these settings would be when editing the RepeaterMatrix field, rather than when editing a field within it outside of the matrix context. By doing that, the RepeaterMatrix module has control at that point, so implementation details are fully in scope and you wouldn't need to now what "matrix4" means or anything like that.1 point
-
setViewData([ 'news' => $news->explode(function ($news_item) { return WireData([ 'title' => $news_item->title, 'date' => $news_item->if('publish_from=today', 'yes', 'no'), 'link' => $news_item->url ]); }) ]); This part looks very familiar to me)))) Try something like pages('id>1000')->each(function ($item) { $today = strtotime('today'); d(date("Y-m-d", $item->modified), $item->if("modified>=$today, modified<tomorrow", 'yes', 'no')); });1 point
-
$wire->addHookBefore('InputfieldForm::render', function(HookEvent $event) { $form = $event->object; if($form->id !== 'ProcessPageEditLinkForm') return; $inputfields = $form->children('name=link_page_id|link_page_file'); foreach ($inputfields as $inputfield) { $inputfield->collapsed = Inputfield::collapsedHidden; } $tab = $form->child('id=link_attributes'); $tab->collapsed = Inputfield::collapsedHidden; });1 point
-
Just released SearchEngine 0.13.0. This version adds more validation regarding the search index field: there's a warning if the field is of wrong type, an option to automatically create it if it doesn't exist (i.e. it has been removed after the module was installed), and there's a notice in the module settings screen if the index field exists and is valid but hasn't been added to any templates yet. Additionally there's a fix for an issue where FieldtypeTextareaLanguage wasn't recognised as a valid index field type in module settings. This could've resulted in the index field setting getting unintentionally cleared if/when module settings were saved.1 point
-
1 point
-
Sanitizer EasySlugger Allows the use of the EasySlugger library as Sanitizer methods. Installation Install the Sanitizer EasySlugger module. Usage The module adds four new sanitizer methods. slugger($string, $options) Similar to $sanitizer->pageName() - I'm not sure if there are any advantages over that method. Included because it is one of the methods offered by EasySlugger. $slug = $sanitizer->slugger('Lorem Ipsum'); // Result: lorem-ipsum utf8Slugger($string, $options) Creates slugs from non-latin alphabets. $slug = $sanitizer->utf8Slugger('这个用汉语怎么说'); // Result: zhe-ge-yong-han-yu-zen-me-shuo seoSlugger($string, $options) Augments the string before turning it into a slug. The conversions are related to numbers, currencies, email addresses and other common symbols. $slug = $sanitizer->seoSlugger('The price is $5.99'); // Result: the-price-is-5-dollars-99-cents See the EasySlugger readme for some more examples. seoUtf8Slugger($string, $options) A combination of utf8Slugger() and seoSlugger(). $slug = $sanitizer->seoUtf8Slugger('价钱是 $5.99'); // Result: jia-qian-shi-5-dollars-99-cents $options argument Each of the methods can take an $options array as a second argument. separator (string): the character that separates words in the slug. Default: - unique (bool): Determines whether a random suffix is added at the end of the slug. Default: false $slug = $sanitizer->utf8Slugger('这个用汉语怎么说', ['separator' => '_', 'unique' => true]); // Result: zhe_ge_yong_han_yu_zen_me_shuo_3ad66c4 https://github.com/Toutouwai/SanitizerEasySlugger https://modules.processwire.com/modules/sanitizer-easy-slugger/1 point
-
@ceberlin @3fingers As of 0.12.0 SearchEngine now supports multi-language indexing and searching. This is based on the native language features, so the results you see depend on the language of current user etc. While I don't have a good test case at hand right now, I did some quick testing on one of my own sites and it seemed to work pretty much as expected – though please let me know if there are problems with the latest version ? What you need to do to enable this is convert the index field (which is by default called search_index) from FieldtypeTextarea to FieldtypeTextareaLanguage.1 point
-
You can even skip the first few steps when you add PW as a "one click app". Either with or without Composer. https://processwire.com/talk/topic/21796-one-click-processwire-in-laragon/?tab=comments#comment-1872871 point
-
? @justb3a Good luck on your (new) way and many, many thanks for all your contributions !! ? ❤️ ?1 point
-
hi, as you might noticed I'm no longer active in the field of PHP and ProcessWire. I tried to continue supporting my modules and wireshell but it turned out that it just doesn't work well if you don't work with it yourself anymore. I would be very happy if someone would be interested in taking over and developing this further. Just write me a message. ? ?1 point
-
You can set the title and name after the page was added: // site/ready.php $this->addHookAfter("Pages::added(template=yourtemplate)", function($event) { $page = $event->arguments(0); $page->setAndSave('title', 'foo'); $page->setAndSave('name', 'foo'); }); You might want to make sure that the name is uniqe (https://processwire.com/api/ref/pages-names/unique-page-name/)1 point
-
This is how I've done it, hooks to the rescue. Clean. $this->addHookProperty('Language::code', function(HookEvent $event) { $lang = $event->object; $event->return = $lang->name === 'default' ? 'en' : $lang->name; }); So now you can access it as a property of languages. $user->language->code;1 point
-
If outputformatting is off it will always return an array.1 point
-
I thought it sounded good, but haven't yet done enough research to answer definitively. I'm not sure that I understand the full scope of changes it would involve yet. But the benefit of meeting that standard would seem to answer any reservations about breaking things into yet more files, assuming it doesn't add overhead to the system. I think it's generally safe for files in /wire/core/, but some concerns about breaking stuff down in /wire/modules/ because there are possible file location dependencies in there (which can be overcome I'm sure). I'm probably not the best person to outline best practices about forks and pull requests. I just know the way that I understand code is a little different from others. I don't have a high comfort level with automated code changes from Git, because it's too easy for me to gloss over the details. I generally need to type something myself before I really see and understand the full scope of it. So the way I handle pull requests is to review the changes and basically re-type (or copy/paste where comfortable) into the code and commit them myself. I still tag it as the pull request so that GitHub understands it as the original pull request. This probably sounds a bit insane, but what can I say, I'm old and it works, and it helps me spot any issues a lot sooner. So if you are interested in making these changes, it doesn't matter to me if you do a pull request or outline the changes here in the forum, email, etc. Whatever works best for you is good with me. Thanks, Ryan1 point