Jump to content

thuijzer

Members
  • Posts

    13
  • Joined

  • Last visited

  • Days Won

    1

thuijzer last won the day on January 18 2018

thuijzer had the most liked content!

Recent Profile Visitors

1,476 profile views

thuijzer's Achievements

Jr. Member

Jr. Member (3/6)

26

Reputation

  1. Thanks, this is indeed what I was looking for (using `$page->editUrl` to link to the edit page). My final code which checks if the user can edit the referenced page: $wire->addHookAfter('InputfieldPage::renderValue', function(HookEvent $event) { $page = $event->object->value; if($page instanceof Page && $page->editable) { $event->return = "<a href='{$page->editUrl}'>{$page->title}</a>"; } });
  2. When you have a pageReference field and set the visibility to `Open + Locked (not editable)`, only the text that you set (default: title) is shown. But is is also possible to enable a link to this page reference? It would be very helpful if a user can navigate to the pageReference.
  3. Yes I made sure I'm working with a Pageimage, but I still don't get it. What I see: The focus of an existing image is updated in the model (avatar field). The "changes" property is updated to notify that "filedata" is changed. When I save the model it returns 'true'. When I debug all database queries I see the model's modified date is updated, but the new focus is never stored. When I change the function PageFiles::resetTrackChanges so that nothing gets reset, the new focus is stored in the database. So somewhere along the way the "changes" property is reset for the avatar field, but I can't figure out when and why. Going to dive deeper into this ?
  4. Yes. This is indeed how I thought it should work. I just discovered that it only works when I create a new image. For example: // this works: $member->of(false); $member->avatar = $filename; // avatar becomes a \ProcessWire\PageImages $member->avatar->first->focus(10, 10); $member->save(); $member->of(true); // this does not work: $member->of(false); $member->avatar->first->focus(50, 50); // avatar already is a \ProcessWire\PageImages $member->save(); $member->of(true); By the way: $member is a \ProcessWire\User but I don't think this should be the problem. So I guess I'm doing something else wrong. Thank you for your reply!
  5. First I like to say that the new(ish) focus function for images is really great! But I can't seem to save focus via the API. Does anyone know how to do this? I tried all methods described in Pageimage.php: $member->avatar->focus($top, $left); $member->save(); $member->avatar->focus($top . ' ' . $left); $member->save(); $member->avatar->focus([$top, $left]); $member->save(); But whatever I try, the focus is never updated/saved. Extra note: in de database the field "filedata" becomes empty when I use the methods described above.
  6. I've never seen that library. That is looking very good. Maybe I will just use this library and create a fieldtype that creates the right settings for this lib. Looks like the license makes this possible. Edit: looks like it needs PHP 7. I think a lot of ProcessWire users are still on 5.6 or even lower, so maybe that's not an option. But I can always take a look at the source
  7. That sounds like a great idea. I will think about a way to enter dates that override opening hours.
  8. My bad. The documentation is wrong. I like to use immutable objects so I created a getter function for the enries: getEntries() The readme is now updated.
  9. @louisstephens Thank you for the screenshot! Note that a 24 hour input is used. So on Saturday you will be open from 3:00-6:00AM and 10:30-12:00AM.
  10. https://github.com/thuijzer/processwire-FieldtypeBusinessHours Fieldtype Business Hours ProcessWire Fieldtype for entering business hours (opening hours) Input format Leave a day empty when closed on that day Times are in 24 hour format. 9:00-12:00 9:00-12:00, 13:00-17:30 16:00-2:00 Usage in templates Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601) echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed'; if($page->field_name[1] == null) { echo 'Closed on Monday'; } if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; } echo $page->field_name[1]; echo $page->field_name[1]->getEntries()->getFrom()->format('H:i');
  11. Thnx I'm totally new to ProcessWire and already starting to become a fan Thank you for the introduction to PIA
  12. While reading the code I noticed the suffix options in the Pageimage class. It seems some settings are added as suffix but not all. So my workaround for now is: $url1 = $image->size(100, 100)->url; $url2 = $image->size(100, 100, array('upscale' => false, 'cropping' => false, 'suffix' => array('noupscsale', 'nocrop')))->url; Resulting in: image.100x100.jpg image.100x100-noupscale-nocrop.jpg
  13. Right now this doesn't seem to work: $url1 = $image->size(100, 100)->url; $url2 = $image->size(100, 100, array('upscale' => false, 'cropping' => false))->url; This is because a filename like image.100x100.jpg is created for both settings. Is there a workaround for this? If not, maybe an additional MD5 hash of the settings could be added to the filename: image.100x100.d8e8fca2dc0f896fd7cb4cb0031ba249.jpg ?
×
×
  • Create New...