Jump to content

gebeer

Members
  • Posts

    1,554
  • Joined

  • Last visited

  • Days Won

    48

Everything posted by gebeer

  1. Hello all, sharing my new module FieldtypeImageReference. It provides a configurable input field for choosing any type of image from selectable sources. Sources can be: a predefined folder in site/templates/ and/or a page (and optionally its children) and/or the page being edited and/or any page on the site CAUTION: this module is under development and not quite yet in a production-ready state. So please test it carefully. UPDATE: the new version v2.0.0 introduces a breaking change due to renaming the module. If you have an older version already installed, you need to uninstall it and install the latest master version. Module and full description can be found on github https://github.com/gebeer/FieldtypeImageReference Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip Read on for features and use cases. Features Images can be loaded from a folder inside site/templates/ or site/assets Images in that folder can be uploaded and deleted from within the inputfield Images can be loaded from other pages defined in the field settings Images can be organized into categories. Child pages of the main 'image source page' serve as categories mages can be loaded from any page on the site From the API side, images can be manipulated like native ProcessWire images (resizing, cropping etc.), even the images from a folder Image thumbnails are loaded into inputfield by ajax on demand Source images on other pages can be edited from within this field. Markup of SVG images can be rendered inline with `echo $image->svgcontent` Image names are fully searchable through the API $pages->find('fieldname.filename=xyz.png'); $pages->find('fieldname.filename%=xy.png'); Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message with links to help you edit those pages and remove references there before you can finally delete the image. This field type can be used with marcrura's Settings Factory module to store images on settings pages, which was not possible with other image field types When to use ? If you want to let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site (e.g. icons, but not limited to that). Other than the native ProcessWire images field, the images here are not stored per page. Only references to images that live on other pages or inside a folder are stored. This has several advantages: one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Installation and setup instructions can be found on github. Here's how the input field looks like in the page editor: If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip Eventually this will go in the module directory, too. But it needs some more testing before I submit it. So I'd really appreciate your assistance. Thanks to all who contributed their feedback and suggestions which made this module what it is now.
  2. @kongondo Thank you for that module. Befor I go and order it, I'd like to make sure that the feature my client needs is included already. For that client each media item should be available as a public download. So in the list of media in the manager there should be something like a button to copy that public link and when editing media that public link should be displayed also. I guess the module needs some customizing to do this. Would this be possible through hooks? Especially for the media lists in the manager. Are there hooks available where I could inject some markup or even an extra column in list view? Since all media are pages, I guess I can hook into ProcessPageEdit for those templates and add the link to display in the page editor screen?
  3. Hello all, I can't seem to find a way to translate the notice type for the admin notices, .g. 'Notices, 'Session' etc. The live search tool on the language edit page does not find it. I also did a search through the wire folder and could nowhere find these terms as translatable expressions. Is this just not possible ATM or am I missing something? I also couldn't find a hook in the core that lets me manipulate the notices. Only AdminThemeRenoHelpers has a non-hookable function renderAdminNotices. That is all I could find.
  4. Thanks again for this great module. I enjoy working with it. Found a small bug, though. The MatrixArray->getValue() method retrieves the value from a matrix field on wire('page'). So it tries to get the matrix field of the page the code is executed on. This isn't always the page we want to process and where the matrix field actually lives on. I changed MatrixArray.php, line 157 to $value = $this->page->$n->get("$rowSel, $colSel"); // instaed of $value = wire('page')->$n->get("$rowSel, $colSel"); Now it is working fine.
  5. Indeed, I don't see a way either. Would be nice to have this as configuration option in the module. Maybe we should file a request to https://github.com/processwire/processwire-requests ?
  6. No, was not looking further. If your code can be implemented as a hook, that would be perfect, I guess.
  7. The addAttachment method requires a file path on the disk, not an url. Try $m->addAttachment ( $page->email_main_img->filename ); See also https://processwire.com/api/ref/pageimage/filename/
  8. @BitPoet @Autofahrn Thank you both for clarifying.
  9. Hi all, On one of my clients installs which is hosted by Strato, I quite sporadically get DB connection errors like: Exception: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'keepsake.store.d0m.de' The server address is wrong here. It always has the store.d0m.de part in it with varying subdomains like trick, whemper etc. The actual address in config.php is rdbms.strato.de. So how can PW possibly try and connect to that wrong address? Does it point to a hacking attempt or is something wrong with Strato's internal DB server routing during high load times? Anyways, just posting this to see if anyone else has seen behaviour like this before. I'll also ask the Strato support and hope they can shed some light...
  10. I just had a similar error message on one of my sites: Uncaught TypeError: Argument 3 passed to ProcessWire\LanguageTranslator::textdomainTemplate() must be of the type array, null given It is not a consisten error, appeared only once in the log. No idea what causes this. Maybe someone can jump in? The site actually uses only 1 language I installed Languages base module so I can have the backend in German.
  11. I did not run into this again and it happened only on that one install which has not been upgraded since. So I'm afraid, I can't tell...
  12. @kongondo Thank you very much for this module. Very useful in a simple shop scenario that I'm building with PW 3.0.125 on PHP 7.2. When I try to dump a Matrix field on a page with bd($p->variationmatrix) I get an error: Exception: Class 'MatrixArray' doesn't yet implement method 'makeBlankItem()' and it needs to. on line: 190 in /var/www/hugoerke.local/wire/core/WireArray.php Just looping over $p->variationmatrix does not throw the exception. As a quick fix, I added the amended original method from WireArray to the MatrixArray Class like this public function makeBlankItem() { $class = wireClassName($this, false); if($class != 'MatrixArray' && $class != 'PaginatedArray') { throw new WireException("Class '$class' doesn't yet implement method 'makeBlankItem()' and it needs to."); } return null; } No more exception now. But still wondering why this happened, maybe something in the core changed that requires every WireArray derived class to redefine this method?
  13. With the the relatively new ProField FieldtypeFieldsetGroup it should be a quick job to add this to all templates.
  14. Is working like a charm ? Thank you!
  15. @Autofahrn @Jan P. Thank you very much for your input. Besides the changes mentioned, did you need any additional rewrite rules in .htaccess?
  16. Hello, I searched the forum but couldn't find posts about the exact same scenario that I am facing. Instead of serving the different languages through a language specific URL, Each language should have their own domain. Everything is served from one single PW installationh, no multisite setup. So instead of domain.com/ domain.com/de/ domain.com/pl/ etc. the language versions should be available under domain.com domain.de domain.pl etc. I found how to switch the language based on the http hostname. But there are a few more questions: How to properly implement the redirection in .htaccess How to configure PW so it doesn't append the language to the URL? (just leave the language names out on the home page settings tab?) I hope someone has had that scenario before and can help out with some hints. Thank you.
  17. @adrian sorry for the late reply. After going through the module code, I feel maintaining this is a bit over my head. Right now I don't have the time resources to take this on. Also I have no idea why the public send method is in there, sorry.
  18. I just extended the module with some extra methods but am not sure if I am up to maintaining it in the long run. Will have a closer look on the weekend and then get back.
  19. @strandoo You can try this code $this->addHookBefore('Inputfield::render', function(HookEvent $event) { if ($this->page->template->name === 'contact') { // adapt template name to compare with $inputfield = $event->object; if($inputfield instanceof InputfieldSelect) $inputfield->addClass('col-sm-8'); $event->return = $inputfield; } }); or this $this->addHookBefore('InputfieldSelect::render', function(HookEvent $event) { //... }
  20. Client side is fine for not so long running tasks. But for queus that take longer you might not want to sit and wait until they're finsished. So I guess server side is the way to go here. Great!
  21. Thanks a lot @flydev So everything goes in the execute method. This will be called after installation which is also fine for me.
  22. This is exactly the scenario I have in mind. My question is how to implement that. Is there a standard method for modules that handles stuff prior to installation, like in my case letting the user choose some fields to use? All the modules I installed so far have a configuration screen after install. I never saw one with configuration options prior to install. Hence my question.
  23. Great to see someone working on a Newsletter module again! Something that is definitely missing in PW. Ryan made a remark here in the last paragraph that he is planning on releasing a ProMailer module. Looking forward to that also. Like @bernhard said, a process module would be the way to go about it, I guess. @horst has released a basic queue module back in 2016 that might come in handy for batch sending.
  24. Hello all, I am currently developing a process module that will create 2 templates and add pages to the page tree that are then being displayed within the module. I'd like to use existing fields for the templates instead of creating my own where possible and have the code for template and page creation inside the install method. Is there a way to let the user choose module options (in my case fields from a select dropdown) before the module is even installed? Is there a generic PW way to go about this?
  25. From the page edit screen under settings you can change the parent of the page and choose Setup there.
×
×
  • Create New...