Jump to content

gebeer

Members
  • Content Count

    984
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by gebeer

  1. To find all pages where the repeater field word_object has a field this_word with value apple you can use subfield selectors $pageArray = $pages->find("word_object.this_word=apple") This will return a PageArray with all those pages. Now to get all the word_object repeater fields from this PageArray, you can use the WireArray explode method $repeatersArray = $pageArray->explode("word_object") This will return an array with all the repeater fields. You can now foreach through this array and output whatever you need. You could also chain this to a single operation $repeatersArray = $pages->find("word_object.this_word=apple")->explode("word_object")
  2. Thanks for that link! An agency I'm sometimes working for wants to have title attributes on all links, no matter what. They say it's for SEO. Sorry for getting offtopic. I'd call them something like 'Input time' and 'Input end' because that is actually what you can do after clicking on them and is also like an instruction of what to do or what can be done. That sure is a long read but well worth it.
  3. This is really only necessary if you are dealing with user input of users from different time zones. You'd also have to know the timezone of the logged in user. For projects where I needed that, I had a field in the user template to save the timezone and did calculations based on that. It is hard to foresee how other people implement it and therefore in the fieldtype you would not know how to get the user timezone. Maybe in a hookable method that by default returns the local server timezone. Then people could hook into it and provide the user timezone only if it differs from the server timezone. The common base for calculation between different timezones is the unix timestamp. So the resulting timestamp for 01.01.2020 20:00 will be different, depending on what the timezone is. The DateTime class has the setTimezone method which helps for conversion of DateTime objects between different timezones. Here's a quick read on the basics.
  4. That looks great so far, will be a really useful fieldtype! I also prefer option 1. Much cleaner than having to involve yet another module. This would be so awesome. Especially since the Recurme module seems to have passed away silently. Maybe you can get some inspiration from there on how to handle recurring stuff. I wouldn't include the whole render a calendar stuff. People who need it can always use some existing framework for that. Would be great if you could share the code pre-release on GH so people who are interested could collaborate. I did some date manipulation in the past because I'm involved with quite a few sites that needed it. What I found most challenging is the timezone calculations. Also did some recurring stuff as far as I remember. What I found very helpful at the time for those tasks are the PHP DateTime, DatePeriod and Dateinterval classes. Haven't delved into it for some 3 years but remember that it actually was fun. I guess today I would use the recurr library. EDIT: As for the recurring events, I'd probably make this optional in the field settings and only present the inputs if needed.
  5. Great. Can't wait to see it (if you plan to release this) 🙂 Any plans for recurring events?
  6. You can take a look at this REST API site profile to see how the author integrated the Vue app and where he put the files within PW file structure. The small example Vue app is inside templates/client/. As always with PW, there are many different ways to accomplish things. This example is one valid route you can take.
  7. Sad to hear that. But can understand your frustration. People coming from WP are used to have new functionality installed with one click. PW just uses a different approach here. And there are custom modules like Media Manager or ImageReference that can do what you need. That is exactly what ImageReference aims to do. I am sorry that it doesn't cater for all of your needs (yet), like descriptions for images from folders. That would be what I meant with hiding the image page in the page tree. The link I provided contains code for such hooks. If you don't know how to put a hook together for your exact use case then describe the problem and I am sure someone will help you out here in the forums.
  8. Just an idea: you could hide the image page from the page tree in the admin area so that users with certain roles cannot mess with it. Some code examples in this thread. EDIT: that would give you your persistent and common path under /site/assets/files/{imagepageID}/
  9. With Image Reference you can have all images on one page (that can be hidden in the tree). Then you set the ImageReference input field to pull images only from that page. Please note that I already have pushed a fix 2 days ago for the responsive issue you posted on GH. The scrolling you are talking about is really only needed for rare edge cases like yours where the ImageRefenrence input field in the page edit screen is very narrow. Please understand that I will not cater for that edge case. You might want to rethink the layout of your gallery input in the page edit screen. If you need descriptions for your images, you can reference them from a hidden page (like mentioned above) instead of from a folder. If someone tries to remove an image from that page and that image is still being referenced somewhere else, the module will give a warning and will not allow to remove the image before all references to it were deleted. So this option could be a solution to your use case.
  10. It doesn't matter whether you create the folder before or after. The module will pick it up once it is there. If it is not there yet, you will get a warning. Once it is there, the warning normally goes away. If it is empty, you will get a warning to upload images. Can't reproduce your problem here on PW 3.0.145 PHP 7.2 But versions really shouldn't matter in that case. Did you install latest master? EDIT: just tested this on PW 3.0.149 and PHP 7.3.2 without problems. Where did you create the folder? It needs to be either in /site/assets/ or /site/templates/. Please try and comment out line 680 in FieldtypeImagereference.module and see if the warning message persists. I attached the error to both the field and globally so it is shown at the top of the page when you save the settings. Maybe this is the culprit in your case?
  11. I think, what you might be looking for is the 'Family' settings for templates. Here you can define, what child templates are allowed for a parent page with a specific template. So, for example, your parent page 'Blog' for your blog items might have the template 'blog' and the child pages (your blog entries) have the template 'blog-item'. In the template's 'Family' settings for template 'blog' you can define to only allow template 'blog-item' as child template. And in the template 'blog-item' you can define to only allow template 'blog' as parent template. Now when an editor adds a page to 'Blog' in the page tree, the new page will automatically get template 'blog-item' assigned.
  12. New version v2.1.2 is out on github. This version fixes a problem with images inside a folder that have names not conform with file naming conventions. When the module loads images from a folder, it converts them to Pageimage objects. When images are added to a Pageimages object file names get sanitized automatically by PW. In my case this resulted in different file names inside the Pageimage object and on disk. Consequently, thumbnails and previews for those images could not be loaded. I fixed this by automatically renaming all folder images to match the sanitized name versions inside a Pagimage object. This version also adds the ability to set values to this field via API. You can now do something like this to set a Pageimage object as new value to this fieldtype via API $p = $pages->get(1001); $image = $p->image; // returns a Pageimage object $p->of(false); $p->set('imagereference', $image); // sets the Pageimage object to the ImageReference field. This gets converted to a JSON string internally for storage $p->save();
  13. This does the job perfectly, indeed. Thanks a lot for that simple yet elegant solution. So all you need to add to site/api/events.php is public function findOne($selector, $options = array()) { return $this->pages->findOne($selector, $options); }
  14. I know this is an old thread. But just had a similar problem. You added the $events instantiation code to your _init.php which, most likely, is in site/templates/. But this code needs to go in site/init.php as stated in the tutorial. Then everything works as expected. The $page object inside template file site/templates/event.php is of Type Event and not Page. Sometimes it's the little details that matter. Posting this info mainly for my own reference. But maybe someone else might find it useful, too :)
  15. The findOne() method is defined in Pages (wire/core/Pages.php). Since your custom Events class extends PagesType, there is no findOne() method available out of the box. You can add one, though. I did this and it worked for me. Here is my site/api/events.php I basically just copied it over from wire/core/Pages.php Since the findOne() method makes use of $this->loader, we need to make sure that the loader is available in our custom class Events. So I added the loader var at the beginning of the class definition and in the construct() method, I instantiated it. Just did this right now to see if it works. In my case I now get a result for $events->findOne("date_publish_start<=now");
  16. Images from cloud storage providers could be added via URL with this module. I agree that it would be awesome to have all these options available in the core image field. Maybe file a feature request? EDIT: But that would add too many setting options to the core field that most of the users won't need. The image field is extendable via hooks and class inheritance. So other modules can add that functionality to the core field on demand.
  17. Hello, and welcome to the forum. This is not really a ProcessWire specific question. You might get advice or even find a solution on stackoverflow.com. And http://youmightnotneedjquery.com/ also might have some useful info.
  18. So true. I share your frustration. If it was for me, I wouldn't care (as you can see on my website, if you speak German). But what to do if clients are pushing? I'd like to see a reliable source for that, too. The thread @szabesz linked to, contains a link to Art. 6 GDPR. But like with all legal texts, as a layman it is hard to interpret them correctly. And even if you ask 3 lawyers you might get 3 different answers... In this thread @ceberlin links to an article on a well known German site for legal advice. I'm no subscriber to that site, so cannot access that information. The whole topic remains mysterious and frustrating. At least clients pay for cookie consent implementation. But I'd rather spend my time with more thrilling tasks...
  19. Hello all, I'm in the process of updating some websites to comply to the new GDPR opt-in regulations. Doing some resarch, I found this open source tool: https://klaro.kiprotect.com/ It looks quite promising and implementation seems quite easy. Have you used this tool? What is your experience so far? I saw that @Jens Martsch - dotnetic made some comments to the klaro GH issues. Did you implement this with PW?
  20. First off, big thanks to all authors for this module! There's a lot of changes going on regarding the legal situation of cookie consent management. The latest requirements for opt-in don't seem to be covered by this module. I tried latest dev version and also @joshua's fork. When clicking on Manage Cookies, I only get 2 options: I consent, I do not consent. There is no list of individual tracking cookies with checkbox to opt-in. I understand that implementing this can be a fairly complex task. Clients in Germany pushing quite hard to have compliant cookie management on their websites. This module does not seem to fulfill this need at the moment. Or am I missing something? Wordpress has paid plugins to accomplish this. But there are open source tools available, that can help to manage cookies compliant to GDPR and ePrivacy laws: https://klaro.kiprotect.com/ and https://www.oiljs.org/ both look promising. Do you have any plans for implementing a similar solution into this module in the future?
  21. gebeer

    SeoMaestro

    I just installed v1.0.0 on PW 3.0.142 and seeing a problem with german umlauts in The Google preview and inherited title. The site has Language Support installed, just to have the backend translated to German. No additional languages. Field title is of type Page Title with textformatter HTML Entity Encoder (standard setting). umlauts.mp4 The title is saved in DB field_title as 'Über uns'. Removing the Entity Encoder Textformatter doesn't help. EDIT: page title is also rendered in the wrong format: Can anyone reproduce this issue? A fix would be greatly appreciated. EDIT: This solution from github issues fixed it for me.
  22. What do you mean by frontend companion? Should frontend vistors be able to choose widgets? Most of the times I don't really need a sophisticated widget system. So far working with page fields solved my needs. In my widget templates I have select fields for the widget position. You'd need a repeater field to define different positions on different pages. To pack the positions into your inputfield would sure be difficult while having good UX at the same time. The widget management module would definitely be very useful to get an overview. That should do it.
  23. I like that approach. Looks great and quite intuitive for the user. Reminds me of old Joomla days. There is a similar page-tree style thing that lets you choose where widgets (in Joomla speak: modules) should show. It would be great if the user could also choose on every page which widgets to show. Like a 2-way thing: in the widget you choose the pages. In the page you choose the widgets. That way you don't have to jump around the page tree to select widgets for pages. I'd definitely be interested in such a inputfield (combination).
  24. Thank you anyway. I have managed to fix this problem. See my post above.
  25. New minor version v2.1.1 with fix for error when using field inside RepeaterMatrix is on github. This was a strange error and, honestly, I still don't quite understand the root cause. When trying to add a new repeatermatrix item with this field inside, I got the error Field [fieldname] is not saveable because it is in a specific context Google brought me to this closed issue in the processwire-issues repo. The issue was related to FieldTypeFile. I just applied the fix for it to my fieldtype module and it worked. But I'd like to understand the underlying problem. So if anybody has any clue, please let me know. Thank you.
×
×
  • Create New...