Jump to content

Robin S

Members
  • Posts

    4,791
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. How is that you have a path to a file (the $filename argument in your function) that exists in a field on a page without any information about the page and field? Where does $filename come from?
  2. @ethfun, if I understand right you would like to validate the page name during the Add Page process. This ought to be possible with a hook to ProcessPageAdd::processInput or InputfieldPageName::processInput, but stuffed if I can get PW to give a field error and return to Add Page; the error is displayed but the page is still added. I thought you could set an error to the inputfield... $my_field->error('That value is not allowed'); ...and the form wouldn't validate but I can't get that work for Add Page. Hopefully someone knows how to do this. BTW, members without a Form Builder license will not be able to read the thread you linked to with the background info. Might be good to include the details here.
  3. That's not the case - I always keep my PageTable items under the Admin branch of the tree and don't have any issues with non-superusers viewing and editing PageTable pages. You just need to make sure: The editor role has edit access (and of course view access) for the template used for the PageTable pages. The editor role has "Add children" access for the template used for the parent page of the PageTable pages. You set this in the "Access" tab of the settings for each template.
  4. The field may not be necessary but I think you'll have to associate the file with a Page (it is called a Pagefile after all). You can do this: $my_files = new Pagefiles($some_page); $my_files->add('/path/to/file.pdf');
  5. Well, it has me stumped. I haven't had or heard of this issue before. I doubt the GitHub issue szabesz linked to is related as that is specific to PageTables added to the user template.
  6. So if you go to those child pages in the tree (not via the PageTable field), can the editor edit those pages? Does the editor role have edit and view permission for the template used by the pages?
  7. Doesn't see them on the front-end or in the admin? Where in the tree are the PageTable pages stored? Are the PageTable pages viewable by editor if you load them directly on the frontend (i.e not via the PageTable field)?
  8. $my_files_field->add('/path/to/file.pdf'); Same for Pageimages, which inherits the methods and properties of Pagefiles. https://processwire.com/api/ref/pagefiles/ https://processwire.com/api/ref/pagefiles/add/
  9. The use cases are the same as those for any inputfield dependency: you want to show or require one field based on the state of another. This module just adds Image and File fields to the types of fields you can use in an inputfield dependency selector. Off the top of my head: you have an images field for an optional gallery and you want to remind the site editor to add a summary/introduction for the gallery if images are added. Also, there was this request for help. @szabesz is right - the screen recorder tool is LICEcap. I discovered it via this post by @bernhard.
  10. All your fields will be added directly to your template - Page fields and other fields. For the Page fields, it is the selectable options for the field that you will create as individual pages elsewhere in the tree. You could put these 'option' pages and their parents directly under the Home page, but I like to group them under a 'Selects' page to separate them from the rest of the site pages. Home Selects Make Toyota Volkswagen ... Color ... A couple of easy ways to create these pages: 1. Use adrian's great Page Field Select Creator module. This is good for when you want to include the ability to add pages (i.e. options for the select) via Pages > Add New because it will create dedicated templates for the option page and the parent page. The module creates the Page field for you. 2. When I don't need the use of the Add New feature and want to avoid unnecessary extra templates I use ImportPagesCSV with the "Paste in CSV Data" option. If all you need is the title then for example you would enter: title Toyota Volkswagen ... With this option you would create the Page field yourself and choose selectable pages, etc.
  11. @szabesz, glad you approve. I have plans for another module relating to inputfield dependencies. Watch this space.
  12. This is off-topic, but in case anyone else is bothered by the gap/collapse issue... After spending some time seeing if this could be resolved in the JS (conclusion: not easily) I found the simplest solution is to avoid the fractional pixels by setting the menu item padding in whole pixels rather than ems. I added this with AdminCustomFiles: .ui-menu .ui-menu-item a { padding:8px 11px; }
  13. It sounds a little unusual (typically you would use an analytics service to track this kind of stuff) but quite doable. You would do it all in your Search template - I don't think there is any issue regarding GET/POST. You sanitize and check the search terms from $input and if they meet your criteria then send the email and create the page. Then output the search results. It would slow down your search results a bit. If that is a problem you could look at using a queue but I don't know much about that.
  14. @thomas, I created a module that allows image and file fields to be used in inputfield dependencies.
  15. Image & File Dependencies Allows Image and File fields to be used in inputfield dependency selectors. Note: prefix field names with an underscore in your dependency selectors. Usage Install the ImageFileDependencies module. You can now create an inputfield dependency based on the number of images or files added to a Image or File field. When you create an inputfield dependency for a Image or File field, prefix your field name with an underscore. Example for a field named 'images': _images>3 Note that you do not include a '.count' subfield in the selector. https://github.com/Toutouwai/ImageFileDependencies Demo
  16. Output buffering works great with delayed output. Set variable default in your auto-prepended init.php: $sidebar = $page->sidebar; Override in your template as needed: <?php ob_start(); // $sidebar ?> <div class="special-promo"> <h2>My special promo sidebar</h2> <?= $page->special_promo ?> </div> <?php $sidebar = ob_get_clean(); ?> Output in auto-appended main.php: <div class="sidebar"> <?= $sidebar ?> </div> I have never entirely understood the benefit of $files->render(), aka wireRenderFile(). Seems to be similar to an include, but with limited variable scope. Personally I'd rather use includes for shared partials so I can get and set any variable inside the partial without needing to explicitly pass variables back and forth from template to rendered file. I've never had to deal with so many variables that I'm losing track of their names and accidentally overwriting them or anything like that. It is possible to get all fields in a page and loop over them: foreach($page->fields as $field) { $field_content = $page->get($field->name); // output $field_content } But there are few situations where this would be useful, because usually you are using several different types of field on a page which return different types of data (string, WireArray, PageImage, etc) and need different markup output. So most of the time you want to get individual fields by name.
  17. This is working for me (PW 3.0.40)... /site/config.php $config->imageSizes = [ "foo" => ["width" => 200, "height" => 200], "bar" => ["width" => 400, "height" => 0], ]; /site/ready.php $this->addHookAfter('InputfieldFile::fileAdded', function($event) { $inputfield = $event->object; if($inputfield->name != 'images') return; // needs to match the name of your images field // alternatively, to use for all image fields... // if($inputfield->class != 'FieldtypeImage') return; $image = $event->argumentsByName("pagefile"); $sizes = isset($this->config->imageSizes) ? $this->config->imageSizes : []; if(count($sizes)) { foreach($sizes as $size) { $image->size($size["width"], $size["height"]); } } }); You won't see the variations immediately inside PageEdit, but you can see them after you save the page.
  18. It seems you must define the multidimensional array in $config in a single statement: $config->imageSizes = [ "foo" => ["width" => 12, "height" => 34], "bar" => ["width" => 56, "height" => 78], ]; Someone else may know the reason for this.
  19. Unfortunately not. The submenu is positioned absolutely by JS and if I set a translate transform or a negative margin the JS accounts for it and places the submenu further to the right so the result is the same. The first submenu vertical position is okay (no gap), it's the horizontal position of the second nested submenu that's where the gap occurs. Edit: just noticed that the gap appears in Chrome too, so it's probably deliberate. Mousing over the gap doesn't cause the menu to collapse in Chrome but it does in Firefox. Edit2: nope, not deliberate because the gap doesn't appear for every dropdown menu - just randomly.
  20. Issue occurs for me in both Firefox and Chrome. Narrowing it down as you suggested, it seems to be the "FieldAndTemplateEditLinks" submodule that's related.
  21. AOS is preventing the normal rendering of an AsmSelect in the field settings for a RepeaterMatrix field. With AOS disabled the field below renders as an AsmSelect: The AsmTweaks option is not active and there are no errors in the JS console. The AsmSelect becomes operational after the field settings page is saved (the problem occurs when creating a new matrix type).
  22. I went with something relatively tame - a Google image search reveals some truly horrendous pics.
  23. For one site I did this... Created two roles - member and pro-member (pro-member is user with active subscription, with permission to view certain pro-only pages). Added expiry field to user template, as adrian suggested. Users can register for free - they get the basic member role with permission to post comments, limited view permission, etc. If a member purchases a (non-renewing) subscription via PayPal: pro-member role is given to user expiry date is set according the duration they purchased and pro-member role is given to user Daily Lazy Cron job: checks for users with subscription expiring in next three days and emails a reminder to renew subscription removes pro-member role from users with expired subscription
  24. A: They're both big in Germany Not a scientific measure for sure, but for forum members who choose to disclose their location Germany seems to be the most common country. I'm curious about why ProcessWire would be especially popular in Germany. Was PW featured in a popular German-language publication or something like that? For German members (or any members actually): how did you first hear about PW?
×
×
  • Create New...