Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/25/2017 in all areas

  1. PHPStorm for PW Devs This thread is a place for ProcessWire developers who use PHPStorm to share their experience, tips, frustrations, solutions, code snippets and generally discuss all things PHPStorm. From Wikipedia: Thanks @kongondo for the Visual Studio Code post earlier.
    5 points
  2. First of all, I copy/pasted your code and did not notice that you used submit instead of send. It is send. I corrected my post above. I've been using MAMP Pro for a while – MAMP should work the same in this regard – and I can send emails even with PHP's built in mail() function, not just with SMTP. Meaning in my system both work. SMTP should work from your own local machine no matter what (provided it is configured properly, of course). I use WireMailSmtp but Swift Mailer should work too. Note that you can make sure the sending bit of the code works by using @adrian's Tracy Debugger. The Mail Interceptor Panel should be turned on temporarily only (Once or Sticky button), and by pasting the snippet into its Console and running it, it should show the message: $mail = wireMail(); $mail->to('your@mail.com')->from('your@mail.com')->subject('test 1')->body('body 1')->send(); So first of all, make sure you can send emails. If Tracy can catch your mail, it means your code is ok, so you can move forward and set SMPT up if needed. If you get stuck with setting up the SMTP module, you can post questions in the appropriate forum threads.
    4 points
  3. wow, did'nt read all the answers, but it seems nobody mentioned markup regions anywhere? soma's post is a must-read of course, but it's also from 2011 and we now have the same functionality a lot easier and cleaner imho: https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ a simple setup could be: _main.php <html> <head> <!-- scripts&co --> </head> <body> <section id="header">your header, menu or the like...</section> <region id="main"></region> <section id="footer">your footer</section> </body> </html> home.php (really no other markup than this in this file!) <section id="main"> <h1>Welcome to my website!</h1> <p>This is the awesome text of my awesome website</p> </section> blogitem.php (for example) <section id="main"> <h1>Blog Item <?= $page->title ?></h1> <?= $page->body ?> <ul> <?php $page->siblings("id!=$page")->each(function($p) { echo "<li><a href='{$p->url}'>{$p->title}</a></li>"; } ?> </ul> </section> This will render your website with header and footer, inject scripts on all sites and just change the content of the main section on your pages.
    3 points
  4. Thanks for all of the additional info, @kongondo. And the delegate approach sounds interesting. It could be a good way to do it when there are some similar-ish templates, which is the case for 2 of my current 6 templates. So it could be a strategy to incorporate into those. However I'm not sure that I would want to do it for everything I'm using, because (correct me if I'm wrong), in that case I'd wind up using 1 template file with a bunch of conditional statements referring to 6 different templates. This, while elegant coding-wise, would surely have a little drawback in readability, at least to me. I might have misunderstood as I am still a newbie, sorry. I'm still very much trying to get to grips with everything and get my head around everything. In any case, I might incorporate this delegate approach for the more similar of my templates where there wouldn't be too many conditional statements. I'm glad that everyone has given me so many different templating strategies to choose from here. @szabesz - thanks, so glad for the warning and for the link to the info about relative paths! Actually I had wondered about that, which was one of the reasons I'd kept my inc files in the same directory as my template files. My own naming convention for my inc files is INC_filenamehere.php , since my editor handles the .php files well, but won't recognize a .inc the same way, and I don't like editing plain text. I like the markup and things to be in different colors like they are on .php files. (Yes I know I can probably change the editor settings to recognize .inc files but I'd prefer to instead go for a filename convention that works for me personally). Plus having inc files start with INC_ means they are all grouped together alphabetically in my template directory anyway. I will update my paths using $config, just as kongondo recommended, so that this way I can ensure that the path is specified explicitly to sidestep the whole problem altogether. Thanks, I read the other 2 articles you linked to also, very helpful info when thinking about templating strategies. Thanks, it's helpful to get ideas of how people are doing it for their own sites. All of this discussion has forced me to think about what's most important to me when templating. It's probably readability and layout. In other words, I need to be able to come back to my templates 6 months from now, and if there's a change I want to make on the page (whether it's displaying a new field or changing some of the styling), I want to be able to do it as quickly as possible without needing to track stuff down much. Parts of my templates can be busy, especially when I have a bunch of nested divs etc with different classes, but it seems to be the main way that makes sense to me while still functioning responsively. Anyway this has given me lots to think about and it's helped highlight to me that there are lots of different possible templating approaches due to the flexibility of ProcessWire. It's not even restricted to only the methods mentioned in the tutorial I had first read. I really appreciate all the help I've received here from everyone.
    3 points
  5. The following topic is old and some of the stuff is probably out of date but well worth reading.
    3 points
  6. With this little tutorial I want to show you how you can change the text of the add new button inside the children tab. This is the default button text which will be rendered on every template where children are allowed: And this is how it look likes after the manipulation: So it is a little bit customized. Maybe you can make it also with JS but I show you a way to change it via a hook inside the ready.php. Copy and adapt the following code into your ready.php. $pages->addHook('ProcessPageEdit::buildForm', function($event) { $page = $this->pages->get($this->input->get->id); $template = $this->pages->get($this->input->get->id)->template; //run the code only on the following templates -> adapt it to your needs if(($template == "event_events") || ($template == "event_dates") || ($template == "event_businessvacations") || ($template == "event_specialbusinesshours")) { $form = $event->return; $field = $event->object; $href = $this->config->urls->admin.'page/add/?parent_id='.$page; $field = $this->modules->get('InputfieldButton'); $field->attr('id+name', 'add_event'); $field->attr('class', $field->class); $field->attr('value', 'Add new event'); $field->attr('href',$href); $field->attr('icon','plus-circle'); $form->insertAfter($field, $form->get("AddPageBtn")); $form->remove($form->get("AddPageBtn")); } }); You can use the code as it is, but you have to adapt the if conditions to run it only on the templates you want. In my case I run it on 4 different templates. You can also change the icon if you want. Hope this will be helpful for some of you!
    2 points
  7. It's just a question of proper naming. See this working example: <?php // MyModule.module class MyModule extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( "title" => "MyModule", "description" => "Adds a button to the module config that executes the foo() method", "version" => "0.0.1", "autoload" => true ); } public function init(){ $this->addHookBefore("ProcessModule::executeEdit", $this, "foo"); } public function foo(HookEvent $event){ if($this->input->post->foobutton) { $this->session->message("foo() executed!"); $this->session->redirect($this->page->httpUrl . "edit?" . $this->input->queryString); } } } <?php // MyModuleConfig.php class MyModuleConfig extends ModuleConfig { public function __construct() { $this->add( [ [ 'name' => 'foobutton', 'type' => 'InputfieldSubmit', 'value' => 'Fire Foo Method', ] ] ); } }
    2 points
  8. i haven't used markup regions on larger projects. ryan said its a little more overhead. but for smaller projects imho it is the cleanest and easiest solution. i think its much easier to understand for newcomers than the regular delayed output. it was also great to work together with my designer
    2 points
  9. I just made a copy of my templates folder, renamed the copy 'templates.delegate' and now in the process of trying out the new markup regions to see how it suits me. Thanks for the newer link @bernhard Having: <region id="main"></region> replaced by: <section id="main"> <h1>Welcome to my website!</h1> <p>This is the awesome text of my awesome website</p> </section> (EDIT - the section tags are not printed) reminds me a bit of extending in twig, where you could: // master template <div id="content">{% block content %}{% endblock %}</div> and then in the child template: {% extends "base.html" %} {% block content %} <h1>Index</h1> <p class="important"> Welcome on my awesome homepage. </p> {% endblock %} Not paid a great deal of attention to this approach but I like the look of it.
    2 points
  10. @BitPoet Thank you very much for the heads-up. Also to @Robin S. I finally ended up with this hook function in a module context which does exactly what I need, also in ajax mode: $this->addHookAfter('Field::getInputfield', $this, "lockConfirmedItems"); public function lockConfirmedItems(HookEvent $event) { if($this->user->isSuperuser() || $this->user->hasRole('certificationadmin')) return; $thisPage = wire('page'); // // Only run our locking logic if we are editing a user in the backend if($thisPage->process != "ProcessUser") return; $repeaterPage = $event->arguments(0); $context = $event->arguments(1); if($context != "_repeater" . $repeaterPage->id) return; if(!$repeaterPage->confirmed) return; $event->return->collapsed = 7; } Setting collapsed with the Inputfield constants like in BitPoet's code didn't work for me.
    2 points
  11. I think you must have misunderstood the tutorial. The pw-* classes are just placeholder tags that ProcessWire parses at render. They are removed in the final markup. There's a very tiny note about it on that page (I'm not sure why it had to be a note and not just in the text proper ) just above Benefits and drawbacks section.
    2 points
  12. All three modules for ProcessWire capable of sending via SMTP are just piggy-back on WireMail (we have WireMailPHPMailer too) meaning we need to install and configure them but otherwise the code to send the actual email via WireMail is the same, but the module takes over to do the actual sending. The approach itself should not matter in this regard. I only use WireMailSmtp but probably the other two modules can also specify things like default Sender address and name, extra signatures, headers, valid recipients, etc... Also, by sending via SMTP the email is less likely to land in a spam folder, and in some server environments it is not even possible to send via the default mail() function. Google offers 200 (as far as I can remember) SMTP messages a day, however the webserver itself should be able to send it via SMTP too. Google can be used if the local environment does not send it for some reason.
    2 points
  13. thanks robin, i found the problem! by coincidence i had to modify one feedback and manually save it. now i wanted to investigate further and got a count of 1 for the answers.count>0 selector. then i saved another page and got a count of 2. so the repeater.count selector seems to work only after a page was saved. i set all the values via API so the selector didn't work. first i thought it's maybe because of setAndSave() but even after a foreach and page->save() the selector didn't work. it works only after a manual pagesave. my quickfix is an additional field + saveready hook that populates the number of answers. I'll file an issue on github.
    2 points
  14. Have had the same issue a few days back and got it working by adding this in line 1 of my template. <?php namespace ProcessWire; ?> The translatable strings are defined in this way: <?php echo __('Kontakt'); ?>
    2 points
  15. You don't have to delete it, but if you're not using composer, there's no reason to keep it.
    2 points
  16. I think @adrian's reply on a similar topic will help what you want to achieve.
    2 points
  17. Probably obvious, but if you want to lock only repeater items that have the checkbox checked then you would add a conditional for that in the hook that BitPoet suggested. if($repPage->your_checkbox) { $event->return->collapsed = ($event->return->collapsed === Inputfield::collapsedNo || $event->return->collapsed === Inputfield::collapsedNoLocked) ? Inputfield::collapsedNoLocked : Inputfield::collapsedYesLocked; }
    2 points
  18. Another option might be the FieldtypeDecimal module: https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/?do=findComment&comment=139097
    2 points
  19. Sites Manager 16 September 2018: FOR NOW, PLEASE DO NOT USE THIS MODULE IN A PRODUCTION SITE. A RECENT ProcessWire UPDATE HAS BROKEN THE MODULE. I AM WORKING ON A FIX. ################ Sites Manager is a module for ProcessWire that allows Superusers to easily create/install ProcessWire sites on the same serverspace the module is running in. Only Superusers can use the module. You can create both stand-alone and multi-sites. Single/Stand-alone Sites Stand-alone or single-sites are sites that will run in their own document root/directory with their own wire and site folders, .htaccess, index.php, etc. In other words, a normal ProcessWire site. Multiple Sites Multi-sites are sites that will run off one wire folder (shared amongst two or more sites) each having their own site folder and database. In this regard, it is important to note that Sites Manager is not in itself a multiple sites solution! Rather, it is a utility that helps you create multi-sites to be run using the ProcessWire core multiple sites feature. For more on this core feature, see the official ProcessWire documentation, specifically the solution referred to as Option #1. Option #1 approach requires the site admin to initially install ProcessWire in a temporary directory for each new site. The directory then needs to be renamed as site-xxx, where ‘xxx’ is any name you want to use to differentiate the installation from other sites, before it is moved to the webroot. For instance, site-mysite, site-another, site-whatever. In addition, the /wire/index.config.php file must be copied/moved to the webroot. Each time a site is added, the index.config.php has to be edited to add ‘domain’ => ‘site-directory’ key=>value pairs for the site. This process can become a bit tedious. This module aims to automate the whole multi-site site creation process. The module is based off the official ProcessWire installer. Creating a site is as simple as completing and submitting a single form! You also have the option to type and paste values or reuse a pre-defined install configuration. The module will: Install a ProcessWire site in your named directory, applying chmod values as specified Move the directory to your webroot Update/Create a Superuser account as per the submitted form, including setting the desired admin theme and colour For multi sites, update sites.json (used by index.config.php to get array of installed sites) For multi sites, the only difference in relation to the core multi-sites index.config.php is that this file is slightly different from the one that ships with ProcessWire. Download from GitHub: Sites Manager (Beta Release) Features Install unlimited number of sites in one (multi-sites) or independent (single-site) ProcessWire installs. Install by completing a Form, Typing or pasting in configurations or using pre-created install configurations. Choose an Admin Theme to auto-install along with the site installation. For single-sites installation, download, save and reuse ProcessWire versions of your choice. Install and maintain site profiles for reuse to create other sites. Create install configurations to speed up installation tasks. Client and server-side validation of site creation values. Edit uploaded profiles (e.g., replace profile file). Lock installed sites, configurations and profiles to prevent editing. Bulk delete items such as site profiles, installed site directories and/or databases (confirmation required for latter two). View important site details (admin login, chmod, etc). Links to installed sites home and admin pages. Timezones auto-complete/-suggest. Pre-requisites, Installation & Usage Please see the documentation. Technicalities/Issues Only Superusers can use the module. ProcessWire 2.7 - 3.x compatible Currently using ProcessWire 2.7 installer (install.php) For multi-sites, potential race condition when sites.json is being updated on a new site install vs. index.config.php accessing the json file? Not tested with sub-directory installs (for instance localhost/pw/my-site-here/) Currently not doing the extra/experimental database stuff (database charset and engine) Future Possibilities Install specified modules along with the ProcessWire install Profile previews? Credits @ryan: for the ProcessWire installer @abdus: for the index.config.php reading from JSON idea @swampmusic: for the challenge Video Demo Demo showing how quick module works on a remote server [YMMV!]. Video shows downloading and processing two versions of ProcessWire (~takes 7 seconds) and installing a single/stand-alone ProcessWire 3 site using the new Admin Theme UI Kit (~2 seconds) on a remote server. Screens 1 2
    1 point
  20. Have narrowed down when the issue occurs. There are two conditions needed to observe the problem: 1. A page using a template containing a repeater is created via the API and is never edited and saved in admin. This means that the parent page of the repeater items under Admin > Repeaters > repeater_field is not yet created. 2. A new repeater item is added via the API to the page created in step 1. When the parent page is created to hold the repeater item, Page Rename Options attempts to rename the parent page but this is not allowed because the parent uses a system template. The existing test for system templates in Page Rename Options fails because the page ID is 0 at this point. The fix goes here, changing a check for $p->id to $p->template: // $p->template check is because it is not available for ProcessPageAdd if($p->template && $p->template->flags & Template::flagSystem) return false; // exclude system templates eg. users etc
    1 point
  21. There is a little error in your hook code: //... $field = $event->object; $href = $this->config->urls->admin.'page/add/?parent_id='.$page; $field = $this->modules->get('InputfieldButton'); //... In this hook, the event object is ProcessPageEdit, not a field. And you also overwrite $field two lines below. Rather than removing the existing button and adding a new one, you can change the text of the existing button. Here is another way it could be done: $wire->addHookAfter('ProcessPageEdit::buildFormChildren', function(HookEvent $event) { $form = $event->return; // The InputfieldWrapper on the "children" tab $ppe = $event->object; // ProcessPageEdit $page = $ppe->getPage(); // ProcessPageEdit contains a method to get the page being edited if(in_array($page->template->name, ['event_events', 'event_dates', 'event_businessvacations', 'event_specialbusinesshours'])) { $button = $form->getChildByName('AddPageBtn'); // Get the button if($button) $button->value = 'Add new event'; // Change the text } });
    1 point
  22. Update: Multi Sites Sites Manager Version 0.0.3. Multi Sites is dead! Long live Multi Sites!! Happy to announce Beta Release of Sites Manager. Please note, no upgrade path from versions 001 or 002 of Multi Sites. I have updated the first post. Download: GitHub Demo: Remote server single site install (PW 3.x + AdminThemeUIKit). YouTube Documentation: GitHub Changelog Changed name to Sites Manager (formerly Multi Sites). Thanks to @szabesz for suggestion. Fixed bugs in Type or Paste method (key=value pairs must now be separated by new line). Beta release.
    1 point
  23. Thanks, I reformatted that part, hopefully it's OK now (for me it didn't appear).
    1 point
  24. Thanks @tpr and @gmclelland for all the updates. Just updated and got this:
    1 point
  25. No, PW 2.3 is no insecure software. It's only missing some tons of new features. I'm also have some PW 2.3 versions running until now, (and don't see any reason to update them).
    1 point
  26. Regarding your no URL issue, most like you image field $image is set to hold multiple images (hence returns an array - whether it has only one image or or more). If that's the case, you will need to loop through it.
    1 point
  27. @ryanC - I don't know what that wireMail() isn't working. I just copied the code from @szabesz's post and with the Mail Interceptor panel enabled, it returned the same result that he had - a successful mail. Just curious - did the AJAX bar appear below the main Tracy debug bar? Assuming you installed a recent version of Tracy your screenshot is showing the main Mail Interceptor panel, not the one updated by Console mail call. Actually it looks like @szabesz has an old version also. See my screenshot showing the AJAX version with (ajax) in the header:
    1 point
  28. Thanks szabesz! I appreciate your help, I'm still learning stuff I wouldn't have known otherwise here.
    1 point
  29. @SamC what are you trying to do exactly? Like always in PW it's up to you. Just wanted to mention markup regions because I didn't see anybody mentioned them. If others are happier with using includes that's totally fine Ps: if performance is a factor for you the best you can do is to invest some euros and 3 minutes to download and install procache. No matter what technique you are using for generating the output, procache will make it lightning fast even on slow servers
    1 point
  30. I think includes() would be faster because it is a function built into php. It's like whatever's in the include file is simply written right into the page. The markup regions have to be processed by PW first to see what goes where, then put it all together for final output. I'm not convinced on markup regions tbh. I'm just not getting how you dynamically change just parts of the regions instead of having to define what goes in the entire region in every template. Maybe just tired! I'll carry on tomorrow.
    1 point
  31. FieldtypeDecimal was the solution that worked better out of the box. Thanks again! Rob
    1 point
  32. You're in luck because I just tried this. // _main.php <region id="header">HEADER</region> <region id="main"></region> <region id="footer">THIS IS MY FOOTER</region> ...and a template: // basic-page.php (used to make the /about/ page) <?php namespace ProcessWire; ?> <region id="header"></region> <region id="main"> <div class="container py-5"> <div class="row justify-content-center"> <div class="col-md-8"> <?= $page->body; ?> </div> </div> </div> </region> <region id="footer"></region> Then on a page made with the basic-page template. The header and footer are hidden completely (from view and source).
    1 point
  33. Thanks szabesz--I will give Tracy DeBugger a shot, and see if emails are working at all.
    1 point
  34. Does adding this to your config.php help? $config->defaultAdminTheme = 'AdminThemeUikit';
    1 point
  35. I have used this approach for the past 4 sites. Now I'm considering other options though. Things like this though... <?php $headline = $page->get("headline|title"); // bodycopy is body text plus comments $bodycopy = $page->body . $page->comments->render(); $sidebar = $page->sidebar; // check if this page has any children if(count($page->children)) { // render sub-navigation in sidebar $sidebar .= "<ul class='nav'>"; foreach($page->children as $child) { $sidebar .= "<li><a href='$child->url'>$child->title</a></li>"; } $sidebar .= "</ul>"; } include("./main.inc"); ...makes me think a few things: 1) Having to make strings out of all my HTML is a royal pita. 2) No autocomplete for HTML tags in ST3 when pretty much everything is chucked into strings. 3) However, this is easier to read than some of the the alternate syntax I'm using i.e. when there's a bunch of if/else, inside a loop, maybe a second loop, then the alternate syntax I also find a pita. 4) I like the idea of being able to pre-populate things, then just render them out later depending on which template is loaded. Makes a fair bit of sense. So, it seems I'm unpleasable good news is, whatever approach you take @Violet you've got a forum full of incredible help here.
    1 point
  36. Previous Related Topics to PHPStorm : XDebug : Autocompletion : PHPUnit:
    1 point
  37. Hi @adrian, I found that the "Enable for API" option prevents Repeater pages being added via the API (for repeaters that contain a title field at least). At this point... $r = $page->my_repeater->getNew(); ...I get the error:
    1 point
  38. Ha, I never noticed that either. Corrected my example. Gonna try this in tracy too, nice tip. @szabesz what extras does wiremailsmtp module bring compared to my approach above?
    1 point
  39. It's doable I think, but the question is what is the default user behaviour, save or publish? You mean very new pages or pages left unpublished for a reason, and then hitting ctrl+s?
    1 point
  40. Thanks for spotting that, @Robin S. That if somehow got lost in translation.
    1 point
  41. Updated the module to to fix the following issues: - missing $sTable variable warning in debug mode. - module now requires you to have PagePathHistory module installed - I simplified SQL, hoping that got rid of the SQL errors, though I could not reproduce them. - remove trailing slashes on "redirect from urls" since PagePathHistory requires them to be missing for redirects to work.
    1 point
  42. Thanks. I used php string replace and some css but I think it's just about the same level of hacky workaround
    1 point
  43. I think you're nearly there. I'll have a stab at this and maybe, if you take code B, and add to it: <?php // wrap the whole thing in a condition that only runs // if the form has actually been submitted if ($input->post->submit) { // get the values submitted from the form via the 'name' attribute on each input field, // pass them through sanitization (to remove any possible malicious code), // and save to variables $name = $sanitizer->text($input->post->name); $userEmail = $sanitizer->email($input->post->email); $comments = $sanitizer->text($input->post->comments); $subject = "Feedback from my site"; $myEmail = "me@me.com"; // construct the email body content that you'll receive $emailContent = " <html> <body> <p><b>Name:</b> {$name}</p> <p><b>Email:</b> {$userEmail}</p> <p><b>Comments:</b></p> <p>{$comments}</p> </body> </html> "; // create new wireMail object $mail = wireMail(); $mail->to($myEmail)->from($userEmail); $mail->subject($subject); $mail->bodyHTML($emailContent); $mail->send(); } ?> It would replace your Code A. I'm not as experienced as the other members here but I think something like this. =EDIT= You'll want some kind of validation though because this would run even if the fields weren't all filled out. This is what... wireIncludeFile("./vendor/vlucas/valitron/src/Valitron/Validator.php"); $v = new \Valitron\Validator(array( "name" => $name, "email" => $email, "message" => $message ) ); $v->rule("required", ["name", "email", "message"]); $v->rule("email", "email"); ...from my original link does. Makes sure the required fields are not empty. Worry about that once the form works though
    1 point
  44. That is really weird. Not sure what could cause that, but some things to try: Add "include=all" to the selector. Add "check_access=0" to the selector. If there is any access control set for the repeater field, select the "Make field value accessible from API even if not viewable" option. Test the selectors in a template file to rule out any issue with the Tracy console.
    1 point
  45. Haven't thoroughly read everything written above. Quick suggestions: $config is your friend For paths, (and other stuff), $config is your friend. Rather than entering paths yourself, let it to the donkey work. For instance, if you have an includes folder in /site/templates/includes/ you can get to that easily using: $path = $config->paths->templates . 'includes/'; Delayed Output If you are not already, I recommend you use this approach. Makes it easy to pass and change variables if needed. See the Automatic Inclusions section (the $config->prependTemplateFile). Your files do not have to be named .inc. They could be .php or even .tpl.
    1 point
  46. A quick&dirty piece for site/ready.php. The collapsed status still needs some working on, but it appears to also be working in ajax mode: wire()->addHookAfter("Field::getInputfield", null, "hookGetInputfield_lockCheckedRepeaters"); function hookGetInputfield_lockCheckedRepeaters(HookEvent $event) { $thisPage = wire('page'); // Only run our locking logic if we are editing the page in the backend if($thisPage->process != "ProcessPageEdit") return; // We don't want to lock the repeater itself (or do we?) if($event->object->type instanceOf FieldtypeRepeater) return; $repPage = $event->arguments(0); $context = $event->arguments(1); // The backend retrieves the field within the repeater context, otherwise something else // is happening we do not want any part of ;-) if($context != "_repeater" . $repPage->id) return; // Set collapsed status in the input field (the event's return), could be made a little // more elaborate $event->return->collapsed = ($event->return->collapsed === Inputfield::collapsedNo || $event->return->collapsed === Inputfield::collapsedNoLocked) ? Inputfield::collapsedNoLocked : Inputfield::collapsedYesLocked; }
    1 point
  47. I think there will be a bit more to it than this, because there are quite a few places in FieldtypeInteger and InputfieldInteger where the value is cast with (int), which will truncate the value of high integers depending on platform. https://stackoverflow.com/questions/670662/whats-the-maximum-size-for-an-int-in-php/2842548#2842548 This one works well.
    1 point
  48. That line that you weren't sure about is preventing the adding or removing of columns from the Users lister. I think you should be able to remove the else{} part because if there are no columns specified in the AOS config then you don't need to do anything to the Lister columns. Also, it would be a little more efficient not to even hook ProcessPageLister::execute when both column AsmSelects are empty in the AOS config... if ( in_array($subModule, $enabledSubmodules) && (!isset($_SERVER['HTTP_REFERER']) || strpos($_SERVER['HTTP_REFERER'], '?bookmark=') === false) && // No need for hook if no tweaks in config (!empty(self::$configData['ListerTweaks_find']) || !empty(self::$configData['ListerTweaks_users'])) ) { // ...
    1 point
  49. A Followup This was an interesting conversation by all parties. What I didn't get was what actual syntax that was put in the /site/config.php file. While this may not matter to more experienced users, it makes a difference to others. My sites don't use Multi-Language and I was still confronted with the error that @EyeDentify noted in the original post when updating an existing site to ProcessWire 3.0.55 This is what I put in the /site/config.php file to make error go away /** * Installer: SetLocale Setting * * This is now needed since ProcessWire 3.0.53 to set local information * */ setlocale(LC_ALL, "en_US.utf8"); As @matjazp stated, it doesn't really matter where in the file this goes. What was confusing to me is that most other settings in the /site/config.php file started with $config and it wasn't clear whether this setting needed to follow that style. As I said, it may not be important to experienced PHP users, but knowing what to put when confronted with this warning is helpful. As an aside, it would also be helpful to know the exact syntax that is needed if using the init or ready files. Maybe I have missed something in reading all this that should have been clear to me and excuse me if I have. If what I have used is incorrect, I ask that someone provide the correct format (styling). Thanks.
    1 point
×
×
  • Create New...